MCPcopy
hub / github.com/locustio/locust / _

Function _

examples/add_command_line_argument.py:5–18  ·  view source on GitHub ↗
(parser)

Source from the content-addressed store, hash-verified

3
4@events.init_command_line_parser.add_listener
5def _(parser):
6 parser.add_argument("--my-argument", type=str, env_var="LOCUST_MY_ARGUMENT", default="", help="It's working")
7 # Choices will validate command line input and show a dropdown in the web UI
8 parser.add_argument("--env", choices=["dev", "staging", "prod"], default="dev", help="Environment")
9 # In combination with choices, is_multiple makes the dropdown in the web UI allow multiple selections
10 parser.add_argument("--endpoints", choices=["a", "b", "c"], is_multiple=True, default=["a"], help="Endpoints")
11 # Set `include_in_web_ui` to False if you want to hide from the web UI
12 parser.add_argument("--my-ui-invisible-argument", include_in_web_ui=False, default="I am invisible")
13 # Set `is_secret` to True if you want the text input to be password masked in the web UI
14 parser.add_argument("--my-ui-password-argument", is_secret=True, default="I am a secret")
15 # Use a boolean default value if you want the input to be a checkmark
16 parser.add_argument("--my-ui-boolean-argument", default=True)
17 # Set `is_required` to mark a form field as required
18 parser.add_argument("--my-ui-required-argument", is_required=True, default="I am required")
19
20
21@events.test_start.add_listener

Callers

nothing calls this directly

Calls 1

add_argumentMethod · 0.80

Tested by

no test coverage detected