Python Click

Command line application ingredients:

  1. arguments, options(flags)
  2. stdin, stdout, stderr
  3. meaningful exit code and logging
  4. signal handle
  5. output colors: rich, colorama modules

Non-click

If no click, how to split subcommand into dedicated file, here is a good example with argparse and importlib module.

Click

Introduction video: https://youtu.be/kNke39OZ2k0

My bootstrap click subcommand lazy loading framework github repo, then I can focus on the functional part.

Colorful output, but logging module(for general purpose) is prefered, 如果不是complex应用,其实使用click 自带的颜色输出就足够了.

0%