Clarify CLI usage error path - #6
Merged
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideDocument the intention behind the CLI usage-error path in main() by adding inline comments clarifying the printed message and exit code semantics. Sequence diagram for CLI usage error handling in main()sequenceDiagram
participant User as actor User
participant CLI as main(argv)
participant Workspace as _extract_workspace_override
participant Env as _workspace_env
participant Dispatcher as _dispatch_and_print
User->>CLI: Run CLI with argv
CLI->>Workspace: _extract_workspace_override(argv)
Workspace-->>CLI: workspace_override, remaining
CLI->>CLI: normalise_workspace_root(workspace_override)
alt No remaining subcommand
CLI->>Dispatcher: _dispatch_and_print(remaining)
CLI-->>User: Print usage message
CLI-->>User: Exit with code 2
else Subcommand present
CLI->>Env: _workspace_env(workspace_root)
Env-->>CLI: (context)
CLI->>Dispatcher: _dispatch_and_print(remaining)
CLI-->>User: Return dispatch result
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
WalkthroughInline comments were added in lading/cli.py to annotate the usage-printing call to _dispatch_and_print(remaining) and the return code (2) for missing subcommand. No functional behavior changed. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68e377d8682c8322b4d54ee16e83f6f8
Summary by Sourcery
Clarify the CLI usage-error path in the main function by adding inline comments to explain printing the usage message and returning exit code 2 for missing subcommands.
Enhancements:
Summary by CodeRabbit