nitpick.cli module

Module that contains the command line app.

Why does this file exist, and why not put this in __main__?

You might be tempted to import things from __main__ later, but that will cause problems: the code will get executed twice:

  • When you run python -mnitpick python will execute __main__.py as a script.

    That means there won’t be any nitpick.__main__ in sys.modules.

  • When you import __main__ it will get executed again (as a module) because

    there’s no nitpick.__main__ in sys.modules.

Also see (1) from https://click.palletsprojects.com/en/5.x/setuptools/#setuptools-integration

nitpick.cli.common_fix_or_check(context, verbose: int, files, check_only: bool) None[source]

Common CLI code for both “fix” and “check” commands.

nitpick.cli.get_nitpick(context: Context) Nitpick[source]

Create a Nitpick instance from the click context parameters.