Skip to content

Commit

Permalink
Merge pull request #62 from sykora/doc-fixes
Browse files Browse the repository at this point in the history
Update README to reflect change in default config file parsing.
  • Loading branch information
martinjm97 authored Oct 13, 2021
2 parents 3c80fe0 + cf26847 commit 0946651
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ class Args(Tap):
args = Args(config_files=['my_config.txt']).parse_args()
```

In addition, if `parse_config_files_with_shlex=True` is passed to `parse_args`, config files are pre-processed using the python standard library `shlex.split` method, which supports shell-style string quoting, as well as comments with `#`.
Config files are parsed using `shlex.split` from the python standard library, which supports shell-style string quoting, as well as line-end comments starting with `#`.

For example, if you have the config file `my_config_shlex.txt`
```
Expand All @@ -500,6 +500,8 @@ class Args(Tap):
arg1: int
arg2: str

args = Args(config_files=['my_config_shlex.txt']).parse_args(parse_config_files_with_shlex=True)
args = Args(config_files=['my_config_shlex.txt']).parse_args()
```
to get the resulting `args = {'arg1': 21, 'arg2': 'two three four'}`

The legacy parsing behavior of using standard string split can be re-enabled by passing `legacy_config_parsing=True` to `parse_args`.

0 comments on commit 0946651

Please sign in to comment.