1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 20:59:50 +04:00
Files
flipperzero-firmware/lib/toolbox/cli/cli_registry_i.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

56 lines
1.2 KiB
C

/**
* @file cli_registry_i.h
* Internal API for getting commands registered with the CLI
*/
#pragma once
#include <furi.h>
#include <m-bptree.h>
#include "cli_registry.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CLI_BUILTIN_COMMAND_STACK_SIZE (4 * 1024U)
typedef struct {
void* context; //<! Context passed to callbacks
CliCommandExecuteCallback execute_callback; //<! Callback for command execution
CliCommandFlag flags;
size_t stack_depth;
} CliRegistryCommand;
#define CLI_COMMANDS_TREE_RANK 4
// -V:BPTREE_DEF2:1103
// -V:BPTREE_DEF2:524
BPTREE_DEF2(
CliCommandTree,
CLI_COMMANDS_TREE_RANK,
FuriString*,
FURI_STRING_OPLIST,
CliRegistryCommand,
M_POD_OPLIST);
#define M_OPL_CliCommandTree_t() BPTREE_OPLIST2(CliCommandTree, FURI_STRING_OPLIST, M_POD_OPLIST)
bool cli_registry_get_command(
CliRegistry* registry,
FuriString* command,
CliRegistryCommand* result);
void cli_registry_lock(CliRegistry* registry);
void cli_registry_unlock(CliRegistry* registry);
/**
* @warning Surround calls to this function with `cli_registry_[un]lock`
*/
CliCommandTree_t* cli_registry_get_commands(CliRegistry* registry);
#ifdef __cplusplus
}
#endif