Skip to content

Commit 51afa53

Browse files
authored
Update documentation to show new serialize kwarg and to clean up misformatted tables (#419)
* Shows new serialize kwarg * Cleans up misformatted tables
1 parent 2cb16f6 commit 51afa53

File tree

4 files changed

+32
-47
lines changed

4 files changed

+32
-47
lines changed

docs/api.md

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,35 @@
11
## Python Fire Quick Reference
22

33
| Setup | Command | Notes
4-
| :------ | :------------------ | :---------
5-
| install | `pip install fire` |
4+
| ------- | ------------------- | ----------
5+
| install | `pip install fire` | Installs fire from pypi
66

77
| Creating a CLI | Command | Notes
8-
| :--------------| :--------------------- | :---------
8+
| ---------------| ---------------------- | ----------
99
| import | `import fire` |
1010
| Call | `fire.Fire()` | Turns the current module into a Fire CLI.
1111
| Call | `fire.Fire(component)` | Turns `component` into a Fire CLI.
1212

13-
| Using a CLI | Command | Notes |
14-
| :----------------------------------------- | :------------- | :------------- |
15-
| [Help](using-cli.md#help-flag) | `command | Show the help |
16-
: : --help` : screen. :
17-
| [REPL](using-cli.md#interactive-flag) | `command -- | Enters |
18-
: : --interactive` : interactive :
19-
: : : mode. :
20-
| [Separator](using-cli.md#separator-flag) | `command -- | This sets the |
21-
: : --separator=X` : separator to :
22-
: : : `X`. The :
23-
: : : default :
24-
: : : separator is :
25-
: : : `-`. :
26-
| [Completion](using-cli.md#completion-flag) | `command -- | Generate a |
27-
: : --completion : completion :
28-
: : [shell]` : script for the :
29-
: : : CLI. :
30-
| [Trace](using-cli.md#trace-flag) | `command -- | Gets a Fire |
31-
: : --trace` : trace for the :
32-
: : : command. :
33-
| [Verbose](using-cli.md#verbose-flag) | `command -- | |
34-
: : --verbose` : :
13+
| Using a CLI | Command | Notes |
14+
| ------------------------------------------ | ----------------- | -------------- |
15+
| [Help](using-cli.md#help-flag) | `command --help` | Show the help screen. |
16+
| [REPL](using-cli.md#interactive-flag) | `command -- --interactive` | Enters interactive mode. |
17+
| [Separator](using-cli.md#separator-flag) | `command -- --separator=X` | This sets the separator to `X`. The default separator is `-`. |
18+
| [Completion](using-cli.md#completion-flag) | `command -- --completion [shell]` | Generate a completion script for the CLI. |
19+
| [Trace](using-cli.md#trace-flag) | `command -- --trace` | Gets a Fire trace for the command. |
20+
| [Verbose](using-cli.md#verbose-flag) | `command -- --verbose` | |
3521

3622
_Note that flags are separated from the Fire command by an isolated `--` arg.
3723
Help is an exception; the isolated `--` is optional for getting help._
3824

3925
## Arguments for Calling fire.Fire()
4026

4127
| Argument | Usage | Notes |
42-
| :-------- | :------------------------ | :----------------------------------- |
43-
| component | `fire.Fire(component)` | If omitted, defaults to a dict of |
44-
: : : all locals and globals. :
45-
| command | `fire.Fire(command='hello | Either a string or a list of |
46-
: : --name=5')` : arguments. If a string is provided, :
47-
: : : it is split to determine the :
48-
: : : arguments. If a list or tuple is :
49-
: : : provided, they are the arguments. If :
50-
: : : `command` is omitted, then :
51-
: : : `sys.argv[1\:]` (the arguments from :
52-
: : : the command line) are used by :
53-
: : : default. :
54-
| name | `fire.Fire(name='tool')` | The name of the CLI, ideally the |
55-
: : : name users will enter to run the :
56-
: : : CLI. This name will be used in the :
57-
: : : CLI's help screens. If the argument :
58-
: : : is omitted, it will be inferred :
59-
: : : automatically. :
28+
| --------- | ------------------------- | ------------------------------------ |
29+
| component | `fire.Fire(component)` | If omitted, defaults to a dict of all locals and globals. |
30+
| command | `fire.Fire(command='hello --name=5')` | Either a string or a list of arguments. If a string is provided, it is split to determine the arguments. If a list or tuple is provided, they are the arguments. If `command` is omitted, then `sys.argv[1:]` (the arguments from the command line) are used by default. |
31+
| name | `fire.Fire(name='tool')` | The name of the CLI, ideally the name users will enter to run the CLI. This name will be used in the CLI's help screens. If the argument is omitted, it will be inferred automatically.|
32+
| serialize | `fire.Fire(serialize=custom_serializer)` | If omitted, simple types are serialized via their builtin str method, and any objects that define a custom `__str__` method are serialized with that. If specified, all objects are serialized to text via the provided method. |
6033

6134
## Using a Fire CLI without modifying any code
6235

docs/guide.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,18 @@ The complete set of flags available is shown below, in the reference section.
742742
| [Trace](using-cli.md#trace-flag) | `command -- --trace` | Gets a Fire trace for the command.
743743
| [Verbose](using-cli.md#verbose-flag) | `command -- --verbose` | Include private members in the output.
744744

745-
_Note that flags are separated from the Fire command by an isolated `--` arg._
745+
_Note that flags are separated from the Fire command by an isolated `--` arg.
746+
Help is an exception; the isolated `--` is optional for getting help._
747+
748+
749+
##### Arguments for Calling fire.Fire()
750+
751+
| Argument | Usage | Notes |
752+
| --------- | ------------------------- | ------------------------------------ |
753+
| component | `fire.Fire(component)` | If omitted, defaults to a dict of all locals and globals. |
754+
| command | `fire.Fire(command='hello --name=5')` | Either a string or a list of arguments. If a string is provided, it is split to determine the arguments. If a list or tuple is provided, they are the arguments. If `command` is omitted, then `sys.argv[1:]` (the arguments from the command line) are used by default. |
755+
| name | `fire.Fire(name='tool')` | The name of the CLI, ideally the name users will enter to run the CLI. This name will be used in the CLI's help screens. If the argument is omitted, it will be inferred automatically.|
756+
| serialize | `fire.Fire(serialize=custom_serializer)` | If omitted, simple types are serialized via their builtin str method, and any objects that define a custom `__str__` method are serialized with that. If specified, all objects are serialized to text via the provided method. |
746757

747758

748759
### Disclaimer

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ Please see [The Python Fire Guide](guide.md).
106106
| [Trace](using-cli.md#trace-flag) | `command -- --trace` | Gets a Fire trace for the command.
107107
| [Verbose](using-cli.md#verbose-flag) | `command -- --verbose` |
108108

109-
_Note that these flags are separated from the Fire command by an isolated `--`._
109+
_Note that flags are separated from the Fire command by an isolated `--` arg.
110+
Help is an exception; the isolated `--` is optional for getting help._
110111

111112
## License
112113

docs/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ To install Python Fire with pip, run: `pip install fire`
44

55
To install Python Fire with conda, run: `conda install fire -c conda-forge`
66

7-
To install Python Fire from source, first clone the repository and then run:
8-
`python setup.py install`
7+
To install Python Fire from source, first clone the repository and then run
8+
`python setup.py install`. To install from source for development, instead run `python setup.py develop`.

0 commit comments

Comments
 (0)