-
Notifications
You must be signed in to change notification settings - Fork 127
Disable commands #643
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
Disable commands #643
Conversation
Codecov Report
@@ Coverage Diff @@
## master #643 +/- ##
==========================================
+ Coverage 94.23% 94.31% +0.08%
==========================================
Files 11 11
Lines 3017 3060 +43
==========================================
+ Hits 2843 2886 +43
Misses 174 174
Continue to review full report at Codecov.
|
tleonhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following need to be done:
- Add a new example or modify an existing one to show usage of this feature
- Update the Sphinx docs
- Update he Changelog
I like the feature. I’m going to think some more and sleep on certain implementation details.
|
@tleonhardt I added an example and updated the docs and change log. |
Not adding disabled commands to the history when run.
tleonhardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things look good. I'd still recommend moving the utility class outside of cmd2.py into another file and making it so that relevant arguments are passed to __init__ and attributes are immutable.
But things look good now.
cmd2/cmd2.py
Outdated
| pass | ||
|
|
||
|
|
||
| class DisabledCommand: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend moving to utils.py, having init take two arguments, and using attrs to make both members immutable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to a namedtuple.
Added way to disable/enable individual commands and entire categories of commands.