Minor changes to readme
This commit is contained in:
parent
7a4b051c1b
commit
5717f466f3
@ -29,14 +29,12 @@ args, kwargs = parse_args(argv=['pargs.py', '--name=Pargs'])
|
|||||||
|
|
||||||
# Specification
|
# Specification
|
||||||
|
|
||||||
`parse_args` parses arguments in the following way, assuming the following command line arguments (`sys.argv`):
|
`parse_args` parses arguments in the following way, assuming the following command line arguments (`sys.argv`): `['/pargs/pargs.py', 'command', 'positional', '--flag', '--optional=value', 'test', '--output-file', 'filename', '-flg', 'name', 'name2']`
|
||||||
|
|
||||||
`['/pargs/pargs.py', 'command', 'positional', '--flag', '--optional=value', 'test', '--output-file', 'filename', '-flg', 'name', 'name2']`
|
|
||||||
|
|
||||||
By calling `args, kwargs = parse_args()`, this would return the following list and dict:
|
By calling `args, kwargs = parse_args()`, this would return the following list and dict:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
args = ['/pargs/pargs.py', 'command', 'positional'],
|
args = ['/pargs/pargs.py', 'command', 'positional']
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'flag': True,
|
'flag': True,
|
||||||
'optional': ['value', 'test'],
|
'optional': ['value', 'test'],
|
||||||
@ -53,4 +51,4 @@ kwargs = {
|
|||||||
- All other arguments are considered optional keyword arguments (`kwargs`)
|
- All other arguments are considered optional keyword arguments (`kwargs`)
|
||||||
- Optional arguments without leading hyphens are considered as values to preceding keyword arguments and saved as list
|
- Optional arguments without leading hyphens are considered as values to preceding keyword arguments and saved as list
|
||||||
- Flags are recorded with the value `True` in the dict
|
- Flags are recorded with the value `True` in the dict
|
||||||
- The leading up to two hyphens are stripped from options, all other hyphens are converted into underscores (`---test-this-` would become `_test_this_`)
|
- Up to 2 leading hyphens are stripped from options, all other hyphens are converted into underscores (`---test-this-` would become `_test_this_`)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user