Skip to content

Commit

Permalink
Clean up messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
inno committed May 11, 2024
1 parent a7e25fb commit c1f60d3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,29 @@ import simplecli

@simplecli.wrap
def main(
name: str, # Your name here
name: str, # Person to greet
):
print(f"Hello, {name}!")
```

```bash
python3 myprogram.py --name="My Name Here"
$ python3 myprogram.py --name="Dade Murphy"
Hello, Dade Murphy!
```

```bash
python3 myprogram.py --help
```
$ python3 myprogram.py --help
Usage:
myprogram.py [name]

Options:
--name Person to greet
--help This message
```

## How It Works

The `wrap` decorator processes the annotated parameters of your function and maps them to corresponding command-line arguments. It uses Python's introspection features and the `tokenize` module to parse inline comments for parameter descriptions, enriching the auto-generated help output.
The `wrap` decorator takes the annotated parameters of a given function and maps them to corresponding command-line arguments. It uses Python's introspection features and the `tokenize` module to parse inline comments for parameter descriptions, enriching the auto-generated help output.

## Why not just use `argparse`?

Expand Down Expand Up @@ -105,8 +112,8 @@ def add(

## Contributing

Read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
Feel free to [open an issue][https://github.com/inno/pysimplecli//issues/new] and [create a pull request][https://github.com/inno/pysimplecli/pulls]!

## License

pysimplecli is open-sourced under the MIT License.
pysimplecli © 2024 by Clif Bratcher is licensed under [CC BY 4.0][https://creativecommons.org/licenses/by/4.0/]

0 comments on commit c1f60d3

Please sign in to comment.