Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ines committed Mar 10, 2023
1 parent 4fe7c7a commit 130a5bf
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ $ python cli.py Alex --age 35 --greet
Hello Alex (35)!
```

Alternatively, you can also use `Radicli.call`:

```python
# cli.py
from radicli import Radicli, Arg

def hello(name: str, age: int):
print(f"Hello {name} ({age})!")

if __name__ == "__main__":
args = dict(name=Arg(help="Your name"), age=Arg("--age", "-a", help="Your age"))
command = Command.from_function("hello", args, hello)
Radicli().call(command)
```

```
$ python cli.py Alex --age 35
Hello Alex (35)!
```

### Subcommands

`radicli` supports one level of nested subcommands. The parent command may exist independently, but it doesn't have to.
Expand Down

0 comments on commit 130a5bf

Please sign in to comment.