-
Notifications
You must be signed in to change notification settings - Fork 116
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
Update cmd2 examples to reflect latest API changes #1000
Comments
Can you give some guidelines on how one can "assess" an example. I definitely would like to jump in on one or two examples and rewrite them. Not sure where to start though. |
First check if the example matches the current API. We are usually pretty good about updating examples when APIs change, but I wouldn't be surprised if some examples are broken. Then determine if you think the example is self-explanatory to a newcomer. This is subjective, but if you think you can make an example more clear, feel free to submit it. |
@jayrod One of the things is we have examples that span a range of API changes over time. We have some that are somewhat redundant in that they are copies/tweaks of another example. In these cases, it may make more sense to combine into a single example with lots of comments explaining the different things being demonstrated. We probably also have some that are no longer representative of how we would recommend developers implement something based on the latest API improvements. For example, today we would probably recommend you register/unregister CommandSets instead of manually hiding/showing commands. |
That's an interesting thing to bring up and could make for a good example. The CLI I work on is a good case for using So instead of it saying, "foo is not a recognized command, alias, or macro" a user is shown something like "foo is only available when in bar mode". Now they know to switch to the proper mode instead of being confused as to why a command no longer exists. There are certainly other cases, like uninstalling a plugin, where I would want to unregister a |
Soo.... how would I figure out which examples you speak of ;) |
@jayrod I used Pycharm to inspect the code in the examples directory. It found an "Unresolved reference" error in colors.py that I just fixed. Doesn't look like there are any other API errors. |
#1392 fixes the broken |
override_parser.py is the one other example I found which is flat out broken and won't run. @anselor @kmvanbrunt I think this would be up either of your alleys if one of you has time to take a quick look at fixing it. |
#1394 fixed the |
We've made a lot of significant improvements in recent releases but some of our examples are still lagging behind a lot. There are cases where the examples no longer represent the easiest/cleanest solution or what we currently consider to be best practices when using cmd2.
examples
directory to help walk people through what's here. Identify which example to start with, and then group/describe the other examplesdecorator_example.py
first_app.py
andhello_cmd2.py
decorator_example.py
arg_decorators.py
anddecorator_example.py
decorator_example.py
hello_cmd2.py
first_app.py
* swap
getattr(args, 'func')
forargs.cmd2_handler.get()
The text was updated successfully, but these errors were encountered: