|
4 | 4 | Command Line Interface |
5 | 5 | ###################### |
6 | 6 |
|
7 | | -The FIREWHEEL Command Line Interface (CLI) allows interaction with and management of FIREWHEEL. |
8 | | -The CLI (:py:mod:`cli/firewheel_cli.py <firewheel.cli.firewheel_cli>`) uses Python's |
9 | | -:py:mod:`cmd` module. |
10 | | -However, there is one notable difference: the CLI is designed to work with a FIREWHEEL cluster which means that commands may need to be executed on one or many hosts. |
11 | | -To accomplish this, the CLI has been extended with :ref:`cli_helper_section`. |
12 | | -:ref:`cli_helper_section` do not use the standard `Cmd <https://docs.python.org/3/library/cmd.html>`_ format, but they enable us to use Python and Shell scripting to perform various actions across the cluster (see :ref:`cli_executors`). |
13 | | -The CLI automatically distributes Helpers to enable performing actions over the entire cluster. |
14 | | -Therefore, the CLI may be accessed from any node in the cluster. |
15 | | -The distinction between commands and Helpers is not relevant for most users so we will use these terms interchangeably. |
16 | | -CLI commands may output error message to the screen, but remote commands will indicate an error through a non-zero exit code. |
| 7 | +Once the Python virtual environment is active, the CLI can be accessed by using the command ``firewheel`` in your terminal or directly using :exc:`firewheel_cli.py <firewheel.cli.firewheel_cli>`. |
| 8 | +This will open up the CLI in "interactive" mode which looks like: |
| 9 | + |
| 10 | +.. code-block:: bash |
| 11 | +
|
| 12 | + $ firewheel |
| 13 | + FIREWHEEL Infrastructure CLI |
| 14 | + fw-cli> |
| 15 | +
|
| 16 | +The CLI also supports single-command execution (or non-interactive mode). |
| 17 | +This is the most common use of the CLI. |
| 18 | +Running the CLI with arguments results in those arguments being treated as a single entered command (and associated arguments). |
| 19 | +For example, the following examples are equivalent: |
| 20 | + |
| 21 | +.. code-block:: bash |
| 22 | +
|
| 23 | + $ firewheel vm mix |
| 24 | +
|
| 25 | +.. code-block:: bash |
| 26 | +
|
| 27 | + fw-cli> vm mix |
| 28 | +
|
| 29 | +Helpers can be invoked by name as a command or using the :ref:`command_run` command. |
| 30 | + |
| 31 | +.. code-block:: bash |
| 32 | +
|
| 33 | + fw-cli> run vm mix |
| 34 | +
|
| 35 | +While it is most common that users will invoke a Helper via its name, using the :ref:`command_run` command also disambiguates a Helper's name from built-in command names. |
| 36 | +Additionally in interactive mode, the :ref:`command_run` command provides the ability to tab-complete Helpers. |
| 37 | + |
| 38 | +Available Helpers can be enumerated using the :ref:`command_list` or :ref:`command_help` commands or they can found here: :ref:`cli_helpers`. |
| 39 | + |
| 40 | +For complete help on any command, use: ``firewheel help <command | Helper>``. |
| 41 | + |
| 42 | +Some commands may take arguments. |
| 43 | +Everything on the command line after the name of the command is treated as an argument to that command. |
| 44 | +Some commands use `Argparse <https://docs.python.org/3/library/argparse.html>`_ to handle arguments. |
| 45 | +In this case, using ``-h`` or ``--help`` flag may also work. |
| 46 | +However, this information *should* also be available by using: ``firewheel help <command | Helper>``. |
| 47 | + |
| 48 | +All CLI commands *should* report success/failure via the exit code. |
| 49 | +Many commands also output useful information directly to the screen. |
| 50 | +For example: |
| 51 | + |
| 52 | +.. code-block:: bash |
| 53 | +
|
| 54 | + $ firewheel repository list |
| 55 | + Installed Model Component Repositories: |
| 56 | + /opt/firewheel/model_components |
| 57 | +
|
| 58 | +As with other FIREWHEEL components, the CLI logs to ``firewheel.log``. |
| 59 | +However, because the CLI is verbose, it has an additional log file (``cli.log``) which contains more in-depth logging information, including the output. |
| 60 | +Additionally, the history of CLI commands is located in ``cli_history.log`` (or it can be accessed via the :ref:`command_history` command). |
| 61 | + |
| 62 | +The location of the CLI-specific log files can be set using FIREWHEEL's configuration. |
17 | 63 |
|
18 | 64 | .. toctree:: |
19 | | - :hidden: |
20 | 65 |
|
21 | | - usage.rst |
22 | | - cli_design.rst |
23 | | - cli_extention.rst |
24 | 66 | commands.rst |
25 | 67 | helper_docs.rst |
0 commit comments