Skip to content

Port remaining standalone-script argparse parsers to click - #39

Merged
mmacferrin merged 1 commit into
mainfrom
port-argparse-to-click
Jul 17, 2026
Merged

Port remaining standalone-script argparse parsers to click#39
mmacferrin merged 1 commit into
mainfrom
port-argparse-to-click

Conversation

@mmacferrin

Copy link
Copy Markdown
Collaborator

Summary

Converts the eight remaining argparse CLIs in src/ivert/ to click, matching the main ivert CLI (issue #7). These are standalone script entry points and are not wired into the main CLI.

Ported files:

  • validate_dem.py
  • validate_dem_collection.py
  • export_vector.py
  • plot_photon_clouds_v2.py
  • icesat2_database_v2.py (argparse subparsers → click group, still defined inside __main__)
  • utils/split_dem.py
  • utils/traverse_directory.py
  • utils/list_photon_tiles.py

No argparse imports remain in src/.

Intentional CLI differences

  • plot_photon_clouds_v2.py: --dem is now repeatable (--dem a.tif --dem b.tif) instead of space-separated multi-value, since click options don't support nargs='+'. --h5 without a path keeps its search-the-cache behavior via a flag_value sentinel.
  • traverse_directory.py: the directory argument is now genuinely optional, defaulting to the current working directory as its help text always claimed (argparse required it despite the declared default).

All other flags, defaults, and help text are unchanged.

Notes

  • utils/list_photon_tiles.py was already broken before this PR: it imports ivert.s3, which was removed with the archive directory (Remove archive directory #37). The port compiles, but the script fails at import — candidate for deletion or repointing in a follow-up.

Testing

  • --help verified for all eight scripts (including the icesat2_database_v2 subcommands)
  • Functional check of traverse_directory.py's single-dash flags (-t, -depth)
  • prek (ruff check + format and all other hooks) passes

Converts the eight remaining argparse CLIs in src/ivert/ to click,
matching the main ivert CLI (issue #7). These are standalone script
entry points and are not wired into the main CLI.

Intentional CLI differences:
- plot_photon_clouds_v2.py: --dem is now repeatable (--dem a --dem b)
  instead of space-separated; --h5 without a path uses a flag_value
  sentinel to keep its search-the-cache behavior.
- traverse_directory.py: the directory argument is now optional,
  defaulting to the current directory as its help text always stated.
@mmacferrin

Copy link
Copy Markdown
Collaborator Author

Codacy is having issues (never succeeding, not related to the code). All other checks passed.

@mmacferrin
mmacferrin merged commit 92d1de5 into main Jul 17, 2026
3 of 4 checks passed
@mmacferrin
mmacferrin deleted the port-argparse-to-click branch July 17, 2026 04:01
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