pypyr.parser.keys permalink

custom boolean switches from the cli permalink

For each input argument, initialize context with a dictionary where each argument becomes the key, with value set to True.

Escape literal spaces with single or double quotes.

Given a pipeline like this, arbitrarily saved as ./keys-parser.yaml:

# ./keys-parser.yaml
context_parser: pypyr.parser.keys
steps:
  - pypyr.steps.debug # prints at log level <=20

Running the pipeline with different inputs:

$ pypyr keys-parser --log 20
{}

$ pypyr keys-parser a b c --log 20
{'a': True, 'b': True, 'c': True}

$ pypyr keys-parser "a with space" ' b' c --log 20
{' b': True, 'a with space': True, 'c': True}

see also

last updated on .