Skip to content

Parser building functions. #1458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2025
Merged

Parser building functions. #1458

merged 3 commits into from
Jul 5, 2025

Conversation

kmvanbrunt
Copy link
Member

All built-in commands now use a function to create their argument parser.
This simplifies the process for overriding cmd2's default parser class.

…ser.

This simplifies the process for overriding cmd2's default parser class.
Copy link

codecov bot commented Jul 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.50%. Comparing base (acb824b) to head (101ac31).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1458      +/-   ##
==========================================
- Coverage   98.50%   98.50%   -0.01%     
==========================================
  Files          20       20              
  Lines        5566     5605      +39     
==========================================
+ Hits         5483     5521      +38     
- Misses         83       84       +1     
Flag Coverage Δ
unittests 98.50% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@tleonhardt tleonhardt added this to the 3.0.0 milestone Jul 5, 2025
…parser.py

Also:
- Delete unused chunk from plugin pyproject.toml
- Upgrade version of ruff used by pre-commit
tleonhardt
tleonhardt previously approved these changes Jul 5, 2025
Copy link
Member

@tleonhardt tleonhardt left a comment

Choose a reason for hiding this comment

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

Everything here looks good to me.

Would it be feasible to move most of the parser building logic to a separate file? If so would it be desirable?

My thought is that cmd2.py is a pretty large file. If it is possible to move a good chunk of related logic to a separate file, that might be a good thing. Given that many if not most of the parser builder functions are class methods, I suspect this might be impossible or painful. But it's worth a thought.

Copy link
Member

@tleonhardt tleonhardt left a comment

Choose a reason for hiding this comment

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

LGTM

@kmvanbrunt kmvanbrunt merged commit bf9750b into main Jul 5, 2025
33 checks passed
@kmvanbrunt kmvanbrunt deleted the parser_functions branch July 5, 2025 12:53
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.

2 participants