Francis Laniel | efb5800 | 2023-12-22 22:02:31 +0100 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | cli command |
| 4 | =========== |
| 5 | |
| 6 | Synopis |
| 7 | ------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | cli get |
| 12 | cli set cli_flavor |
| 13 | |
| 14 | Description |
| 15 | ----------- |
| 16 | |
| 17 | The cli command permits getting and changing the current parser at runtime. |
| 18 | |
| 19 | cli get |
| 20 | ~~~~~~~ |
| 21 | |
| 22 | It shows the current value of the parser used by the CLI. |
| 23 | |
| 24 | cli set |
| 25 | ~~~~~~~ |
| 26 | |
| 27 | It permits setting the value of the parser used by the CLI. |
| 28 | |
Francis Laniel | 3b66e57 | 2023-12-22 22:02:32 +0100 | [diff] [blame] | 29 | Possible values are old and modern. |
Francis Laniel | efb5800 | 2023-12-22 22:02:31 +0100 | [diff] [blame] | 30 | Note that, to use a specific parser its code should have been compiled, that |
| 31 | is to say you need to enable the corresponding CONFIG_HUSH*. |
| 32 | Otherwise, an error message is printed. |
| 33 | |
| 34 | Examples |
| 35 | -------- |
| 36 | |
| 37 | Get the current parser:: |
| 38 | |
| 39 | => cli get |
| 40 | old |
| 41 | |
| 42 | Change the current parser:: |
| 43 | |
Francis Laniel | 3b66e57 | 2023-12-22 22:02:32 +0100 | [diff] [blame] | 44 | => cli get |
| 45 | old |
| 46 | => cli set modern |
| 47 | => cli get |
| 48 | modern |
Francis Laniel | efb5800 | 2023-12-22 22:02:31 +0100 | [diff] [blame] | 49 | => cli set old |
Francis Laniel | 3b66e57 | 2023-12-22 22:02:32 +0100 | [diff] [blame] | 50 | => cli get |
| 51 | old |
Francis Laniel | efb5800 | 2023-12-22 22:02:31 +0100 | [diff] [blame] | 52 | |
| 53 | Trying to set the current parser to an unknown value:: |
| 54 | |
| 55 | => cli set foo |
| 56 | Bad value for parser name: foo |
| 57 | cli - cli |
| 58 | |
| 59 | Usage: |
| 60 | cli get - print current cli |
Francis Laniel | 3b66e57 | 2023-12-22 22:02:32 +0100 | [diff] [blame] | 61 | set - set the current cli, possible values are: old, modern |
| 62 | |
| 63 | Trying to set the current parser to a correct value but its code was not |
| 64 | compiled:: |
| 65 | |
| 66 | => cli get |
| 67 | modern |
| 68 | => cli set old |
| 69 | Want to set current parser to old, but its code was not compiled! |
Francis Laniel | efb5800 | 2023-12-22 22:02:31 +0100 | [diff] [blame] | 70 | |
| 71 | Return value |
| 72 | ------------ |
| 73 | |
| 74 | The return value $? indicates whether the command succeeded. |