Skip to content

Comments

Fix CLI argument parsing and standardize help text#741

Merged
jjjake merged 13 commits intomasterfrom
cli-cleanup
Feb 6, 2026
Merged

Fix CLI argument parsing and standardize help text#741
jjjake merged 13 commits intomasterfrom
cli-cleanup

Conversation

@jjjake
Copy link
Owner

@jjjake jjjake commented Jan 30, 2026

Summary

  • Breaking change: Options using nargs="+" now use nargs=1, requiring repeated flags instead of greedy parsing
    • Old: --format JPEG PNG
    • New: --format JPEG --format PNG
  • Fixes bug where options before positional args failed (e.g., ia download --format "X" myitem)
  • Redesigns PostDataAction to accept JSON, key:value, or key=value formats
  • Fixes incorrect/inconsistent help text across all subcommands
  • Adds 36 comprehensive argument parsing tests
  • Bumps version to 5.8.0.dev0

Test plan

  • All existing tests pass (237 passed)
  • New argument parsing tests pass (36 tests)
  • Manual testing: ia download --format "Item CDX Index" myitem now works
  • Manual testing: ia upload myitem file.txt -m title:Foo -m creator:Bar works

🤖 Generated with Claude Code

jjjake and others added 13 commits January 29, 2026 20:51
Breaking change: Options using nargs="+" now use nargs=1, requiring
repeated flags instead of greedy parsing. For example:
  Old: --format JPEG PNG
  New: --format JPEG --format PNG

This fixes a bug where options placed before positional arguments would
fail to parse correctly (e.g., `ia download --format "X" myitem`).

Changes:
- Change nargs="+" to nargs=1 on all OPTIONS across 8 subcommands
- Redesign PostDataAction to accept JSON, key:value, or key=value
- Fix QueryStringAction bug when same key used across multiple flags
- Fix incorrect help text ("Identifier for the upload" in non-upload cmds)
- Fix inverted --quiet help text in ia delete
- Capitalize all help text consistently
- Add comprehensive argument parsing tests (36 tests)
- Bump version to 5.8.0.dev0

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change all default={} to default=None in add_argument() calls and
add 'or {}' guards in consumers. The shared mutable dict caused
state leakage across parser reuses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consistent with the pattern in ia_delete, ia_copy, ia_move,
ia_upload, and ia_tasks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…parsing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove debug print('hi') in ia_configure.py
- Fix 'list' -> 'reviews' docstring in ia_reviews.py
- Fix 'interneratchive' typo in cli_utils.py module docstring
- Remove unused imports (MetadataAction, signal, Mapping)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- --spread → --format (no such option as --spread)
- action="append" → repeated flags (PR uses custom actions and extend)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jjjake jjjake merged commit 646bb01 into master Feb 6, 2026
23 checks passed
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