Python Command Line Tools by Noah Gift & Alfredo Deza

Python Command Line Tools by Noah Gift & Alfredo Deza

Author:Noah Gift & Alfredo Deza [Noah Gift]
Language: eng
Format: epub
Publisher: Pragmatic AI Solutions
Published: 2020-05-26T16:00:00+00:00


Item 1 total: 30 size: 23MB path: /var/lib severity: High issues: - issue-17 - issue-29

The output now looks a bit like structured YAML. It doesn’t matter, because after taking a second look, it seemed I could do better. What if I could give visual cues that informed without using any more space? This is what coloring can do for you: red can indicate an error, while blue can be informational or for low-priority items. Using a red color for Item 1 would implicitly describe this item as high severity, allowing the removal of severity: High as it would be redundant.

Next, command-line applications tend to like configuration files to implement human-readable defaults, or to avoid too many flags and values in the execution, simplifying working with a tool. Although there is no specific handler for configuration files, in this chapter, we also cover how to integrate config files into Click command-line tools. Finally, sub-commands and other friendly terminal-based interfaces complete the circle of powerful extras to enhance a tool that needs to grow in complexity. In chapter 1, I briefly covered sub-commands to explain how terrible sub-commands are implemented in Python’s standard library (with argparse primarily), which is an excellent introduction. Let’s go into more detail in this chapter.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.