BSB Developer Docs
Loading...
Searching...
No Matches
cli_command.h File Reference

Command metadata and helpers. More...

#include "cli_command_min.h"
#include <furi.h>
#include <containers/pipe.h>
#include <lib/flipper_application/flipper_application.h>

Go to the source code of this file.

Data Structures

struct  CliCommandDescriptor
 
struct  CliCommandExternalConfig
 Configuration for locating external commands. More...
 

Macros

#define CLI_PLUGIN_API_VERSION   1
 
#define CLI_COMMAND_INTERFACE(name, execute_callback, flags, stack_depth, app_id)
 

Functions

bool cli_is_pipe_broken_or_is_etx_next_char (PipeSide *side)
 Detects if Ctrl+C has been pressed or session has been terminated.
 
void cli_print_usage (const char *cmd, const char *usage, const char *arg)
 Print unified cmd usage tip.
 

Detailed Description

Command metadata and helpers.

Macro Definition Documentation

◆ CLI_COMMAND_INTERFACE

#define CLI_COMMAND_INTERFACE ( name,
execute_callback,
flags,
stack_depth,
app_id )
Value:
static const CliCommandDescriptor cli_##name##_desc = { \
#name, \
&execute_callback, \
flags, \
stack_depth, \
}; \
\
static const FlipperAppPluginDescriptor plugin_descriptor = { \
.appid = app_id, \
.ep_api_version = CLI_PLUGIN_API_VERSION, \
.entry_point = &cli_##name##_desc, \
}; \
\
const FlipperAppPluginDescriptor* cli_##name##_ep(void) { \
return &plugin_descriptor; \
}
Definition cli_command.h:19

Function Documentation

◆ cli_is_pipe_broken_or_is_etx_next_char()

bool cli_is_pipe_broken_or_is_etx_next_char ( PipeSide * side)

Detects if Ctrl+C has been pressed or session has been terminated.

Parameters
[in]sidePointer to pipe side given to the command thread
Warning
This function also assumes that the pipe is installed as the thread's stdio
This function will consume 0 or 1 bytes from the pipe

◆ cli_print_usage()

void cli_print_usage ( const char * cmd,
const char * usage,
const char * arg )

Print unified cmd usage tip.

Parameters
cmdcmd name
usageusage tip
argarg passed by user