Skip to content

Add marginal help / marginal help <command> - #78

Open
HarshRajSinghania wants to merge 2 commits into
exactml:masterfrom
HarshRajSinghania:feat/help-subcommand
Open

HarshRajSinghania wants to merge 2 commits into
exactml:masterfrom
HarshRajSinghania:feat/help-subcommand

Conversation

@HarshRajSinghania

Copy link
Copy Markdown
Contributor

Summary

Closes #77.

marginal --help and marginal <command> --help already work via argparse. The bare marginal help / marginal help <command> forms were not recognized and failed with invalid choice: 'help' and exit code 2.

Implementation

  • Register a help subcommand on the top-level parser in marginal/cli/__init__.py.
  • marginal help prints the same top-level usage as marginal --help and exits 0.
  • marginal help init / marginal help review print that subcommand's usage (same as marginal init --help / marginal review --help) and exit 0.
  • Unknown topics (marginal help not-a-command) still go through argparse parser.error and exit 2.

Testing

  • python3 -m pytest tests/test_help.py -q — 4 passed
  • python3 -m pytest tests --ignore=tests/test_providers.py -q — 122 passed (providers module skipped: anthropic not installed in this environment)

CHANGELOG entry for ISSUE-77 will follow in this branch if maintainers want it in the same PR; happy to add it.

@exactml exactml left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the contribution! ❤️ It's really nice to see marginal getting contributions from outside the core maintainers. Really appreciate you taking the time to work on this and help improve the project! 🙏

Comment thread marginal/cli/__init__.py

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move _run_help from marginal/cli/__init__.py into a dedicated marginal/cli/help.py as run_help?

This would keep the CLI structure consistent with run_init and run_review, where each command has its own module and is dispatched from __init__.py. The required arguments can simply be passed into run_help, just like args.path / args.force are passed to run_init.

I don't think this requires any behavioral changes, mainly just a small refactor to keep the CLI organized consistently. 😊

Comment thread marginal/cli/__init__.py Outdated
return 2


def _run_help(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed there is no entry about this new cli capability. Could you also add a CHANGELOG.md entry under UNDER DEVELOPMENT → New Features as well?

@exactml exactml self-assigned this Sep 13, 2026
@exactml exactml added backend backend dev cli feature and removed backend backend dev labels Sep 13, 2026
Keep the CLI package consistent with run_init and run_review by exporting run_help from marginal/cli/help.py.
@HarshRajSinghania

Copy link
Copy Markdown
Contributor Author

Moved _run_help to marginal/cli/help.py as run_help, and marginal/cli/__init__.py now calls that the same way it calls run_init and run_review.

python3 -m pytest tests/test_help.py -q — 4 passed.

The CHANGELOG entry under UNDER DEVELOPMENT → New Features for ISSUE-77 is still outstanding; I will push that on this branch next.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add marginal help / marginal help <command>

2 participants