File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,14 @@ Help is an exception; the isolated `--` is optional for getting help._
60
60
61
61
## Using a Fire CLI without modifying any code
62
62
63
+ You can use Python Fire on a module without modifying the code of the module.
64
+ The syntax for this is:
65
+
63
66
` python -m fire <module> <arguments> `
64
67
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.
Original file line number Diff line number Diff line change @@ -115,6 +115,14 @@ $ python -m fire example hello --name=World
115
115
Hello World!
116
116
```
117
117
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
+
118
126
### Exposing Multiple Commands
119
127
120
128
In the previous example, we exposed a single function to the command line. Now
You can’t perform that action at this time.
0 commit comments