Skip to content

cli(feat) Show help instead of errors when commands lack required args#511

Merged
tony merged 12 commits intomasterfrom
helpful-cli
Feb 8, 2026
Merged

cli(feat) Show help instead of errors when commands lack required args#511
tony merged 12 commits intomasterfrom
helpful-cli

Conversation

@tony
Copy link
Copy Markdown
Member

@tony tony commented Feb 1, 2026

Summary

All four CLI subcommands now print their help screen when called
without required arguments, instead of raising argparse errors or
silently doing nothing:

Command Before After
vcspull sync "No repositories matched" (silently synced nothing) Shows help
vcspull search argparse error Shows help
vcspull add argparse error Shows help
vcspull discover argparse error Shows help

This makes the CLI self-documenting — new users can explore
available options without reaching for --help, and experienced
users get an instant reminder of the expected syntax.

New: --all / -a flag for sync

vcspull sync --all syncs every configured repository. The old
vcspull sync "*" glob still works, but --all is the
recommended way going forward.

--all and positional patterns are mutually exclusive — combining
them is an error.

Breaking change

vcspull sync (no arguments) previously synced nothing and exited
silently. It now shows help. Use vcspull sync --all to sync all
repositories.

Test plan

  • All 740 tests pass (uv run pytest)
  • Ruff linting passes
  • Mypy type checking passes
  • Manual verification:
    • vcspull sync → shows help
    • vcspull sync --all → syncs all repos
    • vcspull sync -a → syncs all repos (short flag)
    • vcspull sync --all "django-*" → error (mutually exclusive)
    • vcspull sync "*" → syncs all repos (backward compat)
    • vcspull search → shows help
    • vcspull add → shows help
    • vcspull discover → shows help

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 1, 2026

Codecov Report

❌ Patch coverage is 82.14286% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.83%. Comparing base (b8725c1) to head (44db8be).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
src/vcspull/cli/sync.py 82.14% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #511      +/-   ##
==========================================
+ Coverage   80.63%   80.83%   +0.20%     
==========================================
  Files          16       16              
  Lines        2236     2249      +13     
  Branches      466      471       +5     
==========================================
+ Hits         1803     1818      +15     
+ Misses        279      276       -3     
- Partials      154      155       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony tony force-pushed the helpful-cli branch 2 times, most recently from d7f76e8 to 15d7f0f Compare February 1, 2026 21:08
@tony tony force-pushed the helpful-cli branch 2 times, most recently from 0bc0c14 to f7c0d21 Compare February 7, 2026 21:59
@tony
Copy link
Copy Markdown
Member Author

tony commented Feb 7, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@tony tony force-pushed the helpful-cli branch 5 times, most recently from 3488c8b to 95a2f31 Compare February 8, 2026 13:47
@tony
Copy link
Copy Markdown
Member Author

tony commented Feb 8, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Review scope: 5 parallel reviewers checked CLAUDE.md adherence, shallow bug scan, git history context, previous PR comments, and code comment compliance across all 8 modified files (207 additions, 67 deletions).

One pre-existing note (not blocking): sync() in src/vcspull/cli/sync.py has a one-line docstring rather than NumPy-style, but this predates the PR.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

tony added 9 commits February 8, 2026 08:37
why: Improve developer experience by providing helpful guidance instead of
cryptic argparse errors or confusing behavior when CLI commands are called
without required arguments.

what:
- Add --all/-a flag to sync command (BREAKING: sync now requires --all to
  sync all repos, previously synced none silently)
- Show help for sync when no patterns and --all not specified
- Show help for search when no query terms provided (changed nargs="+" to "*")
- Show help for add when no repo_path provided (added nargs="?")
- Show help for discover when no scan_dir provided (added nargs="?")
- Update tests to verify new help-on-empty behavior
- Update CLI examples to show vcspull sync --all
why: -a is the short form of --all but was absent from OPTIONS_FLAG_ONLY,
causing the help colorizer to potentially misclassify the next token.
what:
- Add "-a" to the OPTIONS_FLAG_ONLY set
why: The "*" glob pattern is the old way to sync all repos. Help text
should consistently recommend --all instead.
what:
- Replace 'vcspull sync --dry-run "*"' with 'vcspull sync --dry-run --all'
- Replace 'vcspull sync -f ./myrepos.yaml "*"' with 'vcspull sync -f ./myrepos.yaml --all'
why: When --all is specified, positional patterns are silently ignored
because the sync_all branch loads all configs and skips pattern matching.
This is confusing UX — users think they are filtering.
what:
- Add log.warning() when both sync_all and repo_patterns are provided
- Add test fixture for sync --all with a pattern
why: When sync() is called programmatically with no patterns, no --all,
and no parser, it silently returns with no feedback. Programmatic callers
have no way to know nothing happened.
what:
- Add log.warning() in the else branch when parser is None
- Add test_sync_no_patterns_no_parser_warns test
why: SyncFixture now tests search, add, and discover subcommands too,
making the name misleading.
what:
- Rename SyncFixture → CLIFixture
- Rename SYNC_REPO_FIXTURES → CLI_FIXTURES
- Rename test_sync → test_cli_subcommands
why: The combination of --all and --dry-run was untested despite
exercising the async plan-building path for all configured repos.
what:
- Add CLIFixture entry for ["sync", "--all", "--dry-run"]
- Assert "Plan:" appears in output
…terns

why: Address multi-model review consensus finding (Claude+GPT) — combining
--all with patterns silently ignored the patterns, risking unintended
syncs of all repos when users meant to filter.
what:
- Replace log.warning with parser.error() when --all and patterns coexist
- Exit with code 2 (standard argparse error) instead of proceeding
- Update test to expect exit code 2 and error in stderr
why: Address multi-model review consensus finding (Claude+GPT) — the field
name was misleading since CLIFixture now tests all subcommands, not just sync.
what:
- Rename sync_args field to cli_args in CLIFixture NamedTuple
- Rename sync_args parameter to cli_args in test_cli_subcommands
- Rename local cli_args variable to resolved_args to avoid shadowing
tony added 3 commits February 8, 2026 08:40
why: Address multi-model review finding (Claude) — no tests exercised the
-a short alias, and user requested verifying --all equals "*" behavior.
what:
- Add sync--a-short-flag test confirming -a works like --all
- Add sync--star-pattern test confirming "*" matches all repos like --all
why: Address multi-model review finding (Claude) — documentation referenced
SyncFixture/SYNC_REPO_FIXTURES which were renamed to CLIFixture/CLI_FIXTURES.
what:
- Update NamedTuple example from SyncFixture to CLIFixture
- Update field name from sync_args to cli_args
- Update fixture list name from SYNC_REPO_FIXTURES to CLI_FIXTURES
- Update test function name from test_sync to test_cli_subcommands
why: Document user-facing changes from the helpful-cli branch for the
upcoming release.
what:
- Add "What's new" entry for help screens on empty CLI invocations
- Add "Breaking changes" entry for sync --all requirement
@tony tony merged commit 2c316f8 into master Feb 8, 2026
9 checks passed
@tony tony deleted the helpful-cli branch February 8, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant