8000 Documentation updates for 0.4.0. (python -m fire path/to/file.py) · shader/python-fire@fac1ea0 · GitHub
[go: up one dir, main page]

Skip to content

Commit fac1ea0

Browse files
dbiebercopybara-github
authored andcommitted
Documentation updates for 0.4.0. (python -m fire path/to/file.py)
PiperOrigin-RevId: 353255172 Change-Id: I3c88d5e308d236e7a14d0a3639fd8752a60e6cd1
1 parent b61b68c commit fac1ea0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

docs/api.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ Help is an exception; the isolated `--` is optional for getting help._
6060

6161
## Using a Fire CLI without modifying any code
6262

63+
You can use Python Fire on a module without modifying the code of the module.
64+
The syntax for this is:
65+
6366
`python -m fire <module> <arguments>`
6467

65-
For example, `python -m fire calendar -h`.
68+
or
69+
70+
`python -m fire <filepath> <arguments>`
71+
72+
For example, `python -m fire calendar -h` will treat the built in `calendar`
73+
module as a CLI and provide its help.

docs/guide.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ $ python -m fire example hello --name=World
115115
Hello World!
116116
```
117117

118+
You can also specify the filepath of example.py rather than its module path,
119+
like so:
120+
121+
```bash
122+
$ python -m fire example.py hello --name=World
123+
Hello World!
124+
```
125+
118126
### Exposing Multiple Commands
119127

120128
In the previous example, we exposed a single function to the command line. Now

0 commit comments

Comments
 (0)
0