mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-22 01:08:11 -07:00
CLI: Add 'clear' command and command suggestion (#342)
* Add 'clear' command and improve command suggestion in CLI - Introduced a new CLI command 'clear' (alias 'cls') to clear the terminal screen. - Enhanced command not found feedback by suggesting similar commands based on user input. - Added a function to calculate string distance for better command matching. * Review changes * Update changelog --------- Co-authored-by: dexv <89728480+DXVVAY@users.noreply.github.com> Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
This commit is contained in:
@@ -682,6 +682,13 @@ void cli_command_i2c(Cli* cli, FuriString* args, void* context) {
|
||||
furi_hal_i2c_release(&furi_hal_i2c_handle_external);
|
||||
}
|
||||
|
||||
void cli_command_clear(Cli* cli, FuriString* args, void* context) {
|
||||
UNUSED(cli);
|
||||
UNUSED(args);
|
||||
UNUSED(context);
|
||||
printf("\e[2J\e[H");
|
||||
}
|
||||
|
||||
CLI_PLUGIN_WRAPPER("info", cli_command_info)
|
||||
CLI_PLUGIN_WRAPPER("src", cli_command_src)
|
||||
CLI_PLUGIN_WRAPPER("neofetch", cli_command_neofetch)
|
||||
@@ -693,6 +700,7 @@ CLI_PLUGIN_WRAPPER("vibro", cli_command_vibro)
|
||||
CLI_PLUGIN_WRAPPER("led", cli_command_led)
|
||||
CLI_PLUGIN_WRAPPER("gpio", cli_command_gpio)
|
||||
CLI_PLUGIN_WRAPPER("i2c", cli_command_i2c)
|
||||
CLI_PLUGIN_WRAPPER("clear", cli_command_clear)
|
||||
|
||||
void cli_commands_init(Cli* cli) {
|
||||
cli_add_command(cli, "!", CliCommandFlagParallelSafe, cli_command_info_wrapper, (void*)true);
|
||||
@@ -724,4 +732,7 @@ void cli_commands_init(Cli* cli) {
|
||||
cli_add_command(cli, "led", CliCommandFlagDefault, cli_command_led_wrapper, NULL);
|
||||
cli_add_command(cli, "gpio", CliCommandFlagDefault, cli_command_gpio_wrapper, NULL);
|
||||
cli_add_command(cli, "i2c", CliCommandFlagDefault, cli_command_i2c_wrapper, NULL);
|
||||
|
||||
cli_add_command(cli, "clear", CliCommandFlagParallelSafe, cli_command_clear, NULL);
|
||||
cli_add_command(cli, "cls", CliCommandFlagParallelSafe, cli_command_clear, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user