Skip to content
Myr

📝 Update console output with Click 8 messages (#789)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sofie Van Landeghem · committed by GitHub · parent b8ba669 · Browse files · 11 files+18 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

11 files+18 added−18 removed

  • other:+18 added−18 removed

11 files+18 added−18 removed

modified:docs/tutorial/commands/callback.md+1 added-1 removed
modified:docs/tutorial/commands/options.md+4 added-4 removed
65 unmodified lines
6667// Now test the command delete68$ python main.py delete Camila6970# Are you sure you want to delete the user? [y/N]: $ y70# Are you sure you want to delete the user? [y/n]: $ y7172Deleting user: Camila7374$ python main.py delete Wade7576# Are you sure you want to delete the user? [y/N]: $ n76# Are you sure you want to delete the user? [y/n]: $ n7778Operation cancelled7980// And finally, the command delete-all81// Notice it doesn't have CLI arguments, only a CLI option8283$ python main.py delete-all8485# Are you sure you want to delete ALL users? [y/N]: $ y85# Are you sure you want to delete ALL users? [y/n]: $ y8687Deleting all users8889$ python main.py delete-all9091# Are you sure you want to delete ALL users? [y/N]: $ n91# Are you sure you want to delete ALL users? [y/n]: $ n9293Operation cancelled9495// And if you pass the --force CLI option, it doesn't need to confirm
12 unmodified lines
modified:docs/tutorial/multiple-values/arguments-with-multiple-values.md+1 added-1 removed
70 unmodified lines
7172// If you pass an invalid number of arguments you will get an error73$ python main.py Draco Hagrid7475Error: argument names takes 3 values75Error: Argument 'names' takes 3 values7677// And if you pass the exact number of values it will work correctly78$ python main.py Draco Hagrid Dobby79
6 unmodified lines
modified:docs/tutorial/multiple-values/options-with-multiple-values.md+1 added-1 removed
93 unmodified lines
9495// Try with invalid values (not enough)96$ python main.py --user Camila 509798Error: --user option requires 3 arguments98Error: Option '--user' requires 3 arguments99```100101</div>
modified:docs/tutorial/options/prompt.md+1 added-1 removed
106 unmodified lines
107108# Project name: $ Old Project109# Repeat for confirmation: $ New Spice110111Error: the two entered values do not match111Error: The two entered values do not match112113# Project name: $ Old Project114# Repeat for confirmation: $ Old Project115
6 unmodified lines
modified:docs/tutorial/parameter-types/bool.md+1 added-1 removed
52 unmodified lines
5354Usage: main.py [OPTIONS]55Try "main.py --help" for help.5657Error: no such option: --no-force57Error: No such option: --no-force58```5960</div>61
165 unmodified lines
modified:docs/tutorial/parameter-types/datetime.md+1 added-1 removed
36 unmodified lines
37$ python main.py july-19-19893839Usage: main.py [OPTIONS] [%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d%H:%M:%S]4041Error: Invalid value for '[%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]': invalid datetime format: july-19-1989. (choose from %Y-%m-%d, %Y-%m-%dT%H:%M:%S, %Y-%m-%d %H:%M:%S)41Error: Invalid value for 'BIRTH:[%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]': 'july-19-1989' does not match the formats '%Y-%m-%d', '%Y-%m-%dT%H:%M:%S', '%Y-%m-%d %H:%M:%S'.42```4344</div>45
50 unmodified lines
modified:docs/tutorial/parameter-types/enum.md+2 added-2 removed
32 unmodified lines
3334Usage: main.py [OPTIONS]35Try "main.py --help" for help.3637Error: Invalid value for '--network': invalid choice: capsule. (choose from simple, conv, lstm)37Error: Invalid value for '--network': 'capsule' is not one of 'simple', 'conv', 'lstm'.3839// Note that enums are case sensitive by default40$ python main.py --network CONV4142Usage: main.py [OPTIONS]43Try "main.py --help" for help.4445Error: Invalid value for '--network': invalid choice: CONV. (choose from simple, conv, lstm)45Error: Invalid value for '--network': 'CONV' is not one of 'simple', 'conv', 'lstm'.46```4748</div>49
87 unmodified lines
modified:docs/tutorial/parameter-types/index.md+1 added-1 removed
48 unmodified lines
4950Usage: main.py [OPTIONS] NAME51Try "main.py --help" for help.5253Error: Invalid value for '--age': 15.3 is not a valid integer53Error: Invalid value for '--age': '15.3' is not a valid integer5455// Because 15.3 is not an INTEGER (it's a float)56```57
9 unmodified lines
modified:docs/tutorial/parameter-types/number.md+4 added-4 removed
48 unmodified lines
4950Usage: main.py [OPTIONS] ID51Try "main.py --help" for help.5253Error: Invalid value for 'ID': 1002 is not in the valid range of 0 to 1000.53Error: Invalid value for 'ID': 1002 is not in the range 0<=x<=1000.5455// Pass an invalid age56$ python main.py 5 --age 155758Usage: main.py [OPTIONS] ID59Try "main.py --help" for help.6061Error: Invalid value for '--age': 15 is smaller than the minimum valid value 18.61Error: Invalid value for '--age': 15 is not in the range x>=18.6263// Pass an invalid score64$ python main.py 5 --age 20 --score 100.56566Usage: main.py [OPTIONS] ID67Try "main.py --help" for help.6869Error: Invalid value for '--score': 100.5 is bigger than the maximum valid value 100.69Error: Invalid value for '--score': 100.5 is not in the range x<=100.7071// But as we didn't specify a minimum score, this is accepted72$ python main.py 5 --age 20 --score -573
35 unmodified lines
109110Usage: main.py [OPTIONS] ID111Try "main.py --help" for help.112113Error: Invalid value for 'ID': 1002 is not in the valid range of 0 to 1000.113Error: Invalid value for 'ID': 1002 is not in the range 0<=x<=1000.114115// But --rank and --score use clamp116$ python main.py 5 --rank 11 --score -5117
65 unmodified lines
modified:docs/tutorial/parameter-types/uuid.md+1 added-1 removed
40 unmodified lines
4142Usage: main.py [OPTIONS] USER_ID43Try "main.py --help" for help.4445Error: Invalid value for 'USER_ID': 7479706572-72756c6573 is not a valid UUID value45Error: Invalid value for 'USER_ID': 7479706572-72756c6573 is not a valid UUID.46```4748</div>