Layout changes to readme

This commit is contained in:
Patrick Elmer 2022-08-30 15:39:39 +09:00
parent b020b9f5b0
commit 7a4b051c1b

View File

@ -4,7 +4,9 @@ Parse command line arguments into a list of args and a dict of kwargs.
# Installation # Installation
`pip install pargs` ```python
pip install pargs
```
# Usage # Usage
@ -14,7 +16,6 @@ It can be used in the following way.
```python ```python
from pargs import parse_args from pargs import parse_args
args, kwargs = parse_args() args, kwargs = parse_args()
``` ```
@ -23,19 +24,14 @@ The arguments to be parsed can also be specified manually:
```python ```python
from pargs import parse_args from pargs import parse_args
args, kwargs = parse_args(argv=['pargs.py', '--name=Pargs']) args, kwargs = parse_args(argv=['pargs.py', '--name=Pargs'])
``` ```
# Specification # Specification
`parse_args` parses arguments in the following way: `parse_args` parses arguments in the following way, assuming the following command line arguments (`sys.argv`):
Assume the following command line arguments (`sys.argv`): `['/pargs/pargs.py', 'command', 'positional', '--flag', '--optional=value', 'test', '--output-file', 'filename', '-flg', 'name', 'name2']`
```python
['/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: