diff options
| author | Alex Corcoles <alex@pdp7.net> | 2022-10-28 11:29:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-28 11:29:26 +0200 |
| commit | d4057b5508ff8baf0728e25922d0817358df1852 (patch) | |
| tree | d8688b2ce923ca51ff35cf8883a80e0f61e38a29 /programming/python | |
| parent | fdc658901fab1a4e7534132ea8dc7d3f5ad5b552 (diff) | |
Explain the main argparse limitation
Diffstat (limited to 'programming/python')
| -rw-r--r-- | programming/python/creating_nice_python_cli_tools.md | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/programming/python/creating_nice_python_cli_tools.md b/programming/python/creating_nice_python_cli_tools.md index e0071b2a..f878c757 100644 --- a/programming/python/creating_nice_python_cli_tools.md +++ b/programming/python/creating_nice_python_cli_tools.md @@ -26,6 +26,7 @@ Following this advice can make your tools easy to install by others, pleasant to * Consider using the standard [logging](https://docs.python.org/3/library/logging.html) module with a format that uses a timestamp, so users can inspect how much time is spent in different parts of the program. You can also use logging module to implement flags such as `--debug` and `--verbose`. * Although fancier tools exist, the standard [argparse](https://docs.python.org/3/library/argparse.html) module is good enough for most argument parsing. + The main functionality missing is easy tab completion. It has decent support for [sub-commands](https://docs.python.org/3/library/argparse.html#sub-commands), and the linked document describes a very nice pattern to define functions for sub-commands, under "One particularly effective way of handling sub-commands..." Provide help text for non-obvious parameters. argparse supports a lot of different argument types with a lot of functionality out of the box, such as enumerated options, integers, and file names. |
