aboutsummaryrefslogtreecommitdiff
path: root/doc/usage/cmd/cli.rst
blob: 81487722f69cd9cfd334df5c51e901db8775a1c2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.. SPDX-License-Identifier: GPL-2.0+

.. index::
   single: cli (command)

cli command
===========

Synopis
-------

::

    cli get
    cli set cli_flavor

Description
-----------

The cli command permits getting and changing the current parser at runtime.

cli get
~~~~~~~

It shows the current value of the parser used by the CLI.

cli set
~~~~~~~

It permits setting the value of the parser used by the CLI.

Possible values are old and modern.
Note that, to use a specific parser its code should have been compiled, that
is to say you need to enable the corresponding CONFIG_HUSH*.
Otherwise, an error message is printed.

Examples
--------

Get the current parser::

    => cli get
    old

Change the current parser::

    => cli get
    old
    => cli set modern
    => cli get
    modern
    => cli set old
    => cli get
    old

Trying to set the current parser to an unknown value::

    => cli set foo
    Bad value for parser name: foo
    cli - cli

    Usage:
    cli get - print current cli
    set - set the current cli, possible values are: old, modern

Trying to set the current parser to a correct value but its code was not
compiled::

    => cli get
    modern
    => cli set old
    Want to set current parser to old, but its code was not compiled!

Return value
------------

The return value $? indicates whether the command succeeded.