What does it mean when Click exits with exit code 2?

Viewed 2948
2 Answers

I ran

result = runner.invoke(cli, ['sync'])

instead of

result = runner.invoke(cli, ['--debug', 'sync'])

So you need to specify the flag as entered via CLI, not only pass the parameters consumed by the function if you use @click.option.

Additionally, the I made a typo for one of the flags.

How to debug

  1. Look at the parameters you pass to runner.invoke (simplest: print it)
  2. Execute it via CLI (e.g. cli(['--debug', 'sync']))

In my case this gave me the message

Error: no such option: --sync  Did you mean --syncs?
Related