BSB Developer Docs
Loading...
Searching...
No Matches
cli_command.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "cli_command_min.h"
9#include <furi.h>
10#include <containers/pipe.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#define CLI_PLUGIN_API_VERSION 1
18
19typedef struct {
20 char* name;
21 CliCommandExecuteCallback execute_callback;
22 CliCommandFlag flags;
23 size_t stack_depth;
25
29typedef struct {
30 const char* search_directory; //<! The directory to look in
31 const char* fal_prefix; //<! File name prefix that commands should have
32 const char* appid; //<! Expected plugin-reported appid
34
44
51void cli_print_usage(const char* cmd, const char* usage, const char* arg);
52
53#define CLI_COMMAND_INTERFACE(name, execute_callback, flags, stack_depth, app_id) \
54 static const CliCommandDescriptor cli_##name##_desc = { \
55 #name, \
56 &execute_callback, \
57 flags, \
58 stack_depth, \
59 }; \
60 \
61 static const FlipperAppPluginDescriptor plugin_descriptor = { \
62 .appid = app_id, \
63 .ep_api_version = CLI_PLUGIN_API_VERSION, \
64 .entry_point = &cli_##name##_desc, \
65 }; \
66 \
67 const FlipperAppPluginDescriptor* cli_##name##_ep(void) { \
68 return &plugin_descriptor; \
69 }
70
71#ifdef __cplusplus
72}
73#endif
void cli_print_usage(const char *cmd, const char *usage, const char *arg)
Print unified cmd usage tip.
Definition cli_command.c:11
bool cli_is_pipe_broken_or_is_etx_next_char(PipeSide *side)
Detects if Ctrl+C has been pressed or session has been terminated.
Definition cli_command.c:4
Bare minimum for internal CLI commands including redundant opaque types defined elsewhere.
CliCommandFlag
Definition cli_command_min.h:13
void(* CliCommandExecuteCallback)(PipeSide *pipe, FuriString *args, void *context)
CLI command execution callback pointer.
Definition cli_command_min.h:48
Flipper application.
Pipe convenience module.
Definition cli_command.h:19
Configuration for locating external commands.
Definition cli_command.h:29
There are two PipeSides per pipe.
Definition pipe.c:22