Files
Momentum-Firmware/lib/toolbox/cli/shell/cli_shell.h
Anna Antonenko 7192c9e68b [FL-3965] Separate cli_shell into toolbox (#4175)
* cli_shell: separate into toolbox

* fix: cmd flags

* fix formatting

* cli: increase default stack depth

* cli_shell: fix loader lock logic

* cli: fix command flags

* fix f18

* speaker_debug: fix

* cli_registry: fix docs

* ufbt: rename cli target back

* cli: rename app and record

* cli: fix and simplify help command

* cli_master_shell: fix ext commands

* fix formatting

* cli: rename master to main

* fix formatting

---------

Co-authored-by: hedger <hedger@users.noreply.github.com>
2025-04-05 02:58:58 +04:00

76 lines
1.6 KiB
C

#pragma once
#include <furi.h>
#include <toolbox/pipe.h>
#include "../cli_registry.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CLI_SHELL_STACK_SIZE (4 * 1024U)
typedef struct CliShell CliShell;
/**
* Called from the shell thread to print the Message of the Day when the shell
* is started.
*/
typedef void (*CliShellMotd)(void* context);
/**
* @brief Allocates a shell
*
* @param [in] motd Message of the Day callback
* @param [in] context Callback context
* @param [in] pipe Pipe side to be used by the shell
* @param [in] registry Command registry
* @param [in] ext_config External command configuration. See
* `CliCommandExternalConfig`. May be NULL if support for
* external commands is not required.
*
* @return Shell instance
*/
CliShell* cli_shell_alloc(
CliShellMotd motd,
void* context,
PipeSide* pipe,
CliRegistry* registry,
const CliCommandExternalConfig* ext_config);
/**
* @brief Frees a shell
*
* @param [in] shell Shell instance
*/
void cli_shell_free(CliShell* shell);
/**
* @brief Starts a shell
*
* The shell runs in a separate thread. This call is non-blocking.
*
* @param [in] shell Shell instance
*/
void cli_shell_start(CliShell* shell);
/**
* @brief Joins the shell thread
*
* @warning This call is blocking.
*
* @param [in] shell Shell instance
*/
void cli_shell_join(CliShell* shell);
/**
* @brief Sets optional text before prompt (`>:`)
*
* @param [in] shell Shell instance
*/
void cli_shell_set_prompt(CliShell* shell, const char* prompt);
#ifdef __cplusplus
}
#endif