| 1 | # Next Steps |
| 2 | |
| 3 | Once your current application is using `cmd2`, you can start to expand the functionality by |
| 4 | leveraging other `cmd2` features. The three ideas here will get you started. Browse the rest of the |
| 5 | [Features](../features/index.md) to see what else `cmd2` can help you do. |
| 6 | |
| 7 | ## Argument Parsing |
| 8 | |
| 9 | For all but the simplest of commands, it's probably easier to use |
| 10 | [argparse](https://docs.python.org/3/library/argparse.html) to parse user input than to do it |
| 11 | manually yourself for each command. `cmd2` provides a `@with_argparser()` decorator which associates |
| 12 | a `Cmd2ArgumentParser` object with one of your commands. Using this method will: |
| 13 | |
| 14 | 1. Pass your command a |
| 15 | [Namespace](https://docs.python.org/3/library/argparse.html#argparse.Namespace) containing the |
| 16 | arguments instead of a string of text |
| 17 | 2. Properly handle quoted string input from your users |
| 18 | 3. Create a help message for you based on the `Cmd2ArgumentParser` |
| 19 | 4. Give you a big head start adding [Tab Completion](../features/completion.md) to your application |
| 20 | 5. Make it much easier to implement subcommands (i.e. `git` has a bunch of subcommands such as |
| 21 | `git pull`, `git diff`, etc) |
| 22 | |
| 23 | There's a lot more about [Argument Processing](../features/argument_processing.md) if you want to |
| 24 | dig in further. |
| 25 | |
| 26 | ## Help |
| 27 | |
| 28 | If you have a lot of commands in your application, `cmd2` can categorize those commands using a one |
| 29 | line decorator `@with_category()`. When a user types `help` the available commands will be organized |
| 30 | by the category you specified. |
| 31 | |
| 32 | If you were already using `argparse` or decided to switch to it, you can easily |
| 33 | [standardize all of your help messages](../features/argument_processing.md#help-messages) to be |
| 34 | generated by your argument parsers and displayed by `cmd2`. No more help messages that don't match |
| 35 | what the code actually does. |
| 36 | |
| 37 | ## Generating Output |
| 38 | |
| 39 | If your program generates output by printing directly to `sys.stdout`, you should consider switching |
| 40 | to `cmd2.Cmd.poutput`, `cmd2.Cmd.perror`, and `cmd2.Cmd.pfeedback`. These methods work with several |
| 41 | of the built in [Settings](../features/settings.md) to allow the user to view or suppress feedback |
| 42 | (i.e. progress or status output). They also properly handle ANSI colored output according to user |
| 43 | preference. `cmd2`'s dependency on :simple-rich: [rich](https://github.com/Textualize/rich) makes it |
| 44 | easy to add color and style to your output. See the |
| 45 | [Colored Output](../features/generating_output.md#colored-output) section for more details. These |
| 46 | and other related topics are covered in [Generating Output](../features/generating_output.md). |