refactor(console): Enable astyle formatting

This commit is contained in:
Peter Marcisovsky 2024-04-29 16:12:51 +02:00
parent fe3fd4ae43
commit 0bfaf775c1
8 changed files with 36 additions and 37 deletions

View File

@ -250,22 +250,22 @@ static struct {
static void print_arg_help(cmd_item_t *it)
{
/* First line: command name and hint
* Pad all the hints to the same column
*/
const char *hint = (it->hint) ? it->hint : "";
printf("%-s %s\n", it->command, hint);
/* Second line: print help.
* Argtable has a nice helper function for this which does line
* wrapping.
*/
printf(" "); // arg_print_formatted does not indent the first line
arg_print_formatted(stdout, 2, 78, it->help);
/* Finally, print the list of arguments */
if (it->argtable) {
arg_print_glossary(stdout, (void **) it->argtable, " %12s %s\n");
}
printf("\n");
/* First line: command name and hint
* Pad all the hints to the same column
*/
const char *hint = (it->hint) ? it->hint : "";
printf("%-s %s\n", it->command, hint);
/* Second line: print help.
* Argtable has a nice helper function for this which does line
* wrapping.
*/
printf(" "); // arg_print_formatted does not indent the first line
arg_print_formatted(stdout, 2, 78, it->help);
/* Finally, print the list of arguments */
if (it->argtable) {
arg_print_glossary(stdout, (void **) it->argtable, " %12s %s\n");
}
printf("\n");
}
static int help_command(int argc, char **argv)
@ -322,7 +322,7 @@ esp_err_t esp_console_register_help_command(void)
esp_console_cmd_t command = {
.command = "help",
.help = "Print the summary of all registered commands if no arguments "
"are given, otherwise print summary of given command.",
"are given, otherwise print summary of given command.",
.func = &help_command,
.argtable = &help_args
};

View File

@ -78,7 +78,7 @@ typedef struct {
*/
typedef struct {
int channel; //!< UART channel number (count from zero)
int baud_rate; //!< Comunication baud rate
int baud_rate; //!< Communication baud rate
int tx_gpio_num; //!< GPIO number for TX path, -1 means using default one
int rx_gpio_num; //!< GPIO number for RX path, -1 means using default one
} esp_console_dev_uart_config_t;

View File

@ -83,7 +83,7 @@ esp_err_t esp_console_new_repl_usb_cdc(const esp_console_dev_usb_cdc_config_t *d
/* spawn a single thread to run REPL */
if (xTaskCreatePinnedToCore(esp_console_repl_task, "console_repl", repl_config->task_stack_size,
cdc_repl, repl_config->task_priority, &cdc_repl->repl_com.task_hdl, repl_config->task_core_id) != pdTRUE) {
cdc_repl, repl_config->task_priority, &cdc_repl->repl_com.task_hdl, repl_config->task_core_id) != pdTRUE) {
ret = ESP_FAIL;
goto _exit;
}
@ -160,7 +160,7 @@ esp_err_t esp_console_new_repl_usb_serial_jtag(const esp_console_dev_usb_serial_
/* spawn a single thread to run REPL */
if (xTaskCreatePinnedToCore(esp_console_repl_task, "console_repl", repl_config->task_stack_size,
usb_serial_jtag_repl, repl_config->task_priority, &usb_serial_jtag_repl->repl_com.task_hdl, repl_config->task_core_id) != pdTRUE) {
usb_serial_jtag_repl, repl_config->task_priority, &usb_serial_jtag_repl->repl_com.task_hdl, repl_config->task_core_id) != pdTRUE) {
ret = ESP_FAIL;
goto _exit;
}
@ -217,7 +217,7 @@ esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_con
#elif SOC_UART_SUPPORT_XTAL_CLK
uart_sclk_t clk_source = UART_SCLK_XTAL;
#else
#error "No UART clock source is aware of DFS"
#error "No UART clock source is aware of DFS"
#endif // SOC_UART_SUPPORT_xxx
const uart_config_t uart_config = {
.baud_rate = dev_config->baud_rate,
@ -262,7 +262,7 @@ esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_con
/* Spawn a single thread to run REPL, we need to pass `uart_repl` to it as
* it also requires the uart channel. */
if (xTaskCreatePinnedToCore(esp_console_repl_task, "console_repl", repl_config->task_stack_size,
uart_repl, repl_config->task_priority, &uart_repl->repl_com.task_hdl, repl_config->task_core_id) != pdTRUE) {
uart_repl, repl_config->task_priority, &uart_repl->repl_com.task_hdl, repl_config->task_core_id) != pdTRUE) {
ret = ESP_FAIL;
goto _exit;
}

View File

@ -51,7 +51,7 @@ static void prepare_input_stream(void)
assert(tcgetattr(stdin_fileno, &s_orig_termios) == 0);
struct termios raw = s_orig_termios;
raw.c_iflag |= ICRNL; // we translate to NL because linenoise expects NL
raw.c_lflag &= ~(ECHO | ICANON); // turn off echo and cononical mode
raw.c_lflag &= ~(ECHO | ICANON); // turn off echo and canonical mode
assert(tcsetattr(stdin_fileno, TCSAFLUSH, &raw) == 0);
// Make sure user does not end up with a broken terminal

View File

@ -47,5 +47,5 @@ void esp_console_repl_task(void *args);
esp_err_t esp_console_common_init(size_t max_cmdline_length, esp_console_repl_com_t *repl_com);
esp_err_t esp_console_setup_prompt(const char *prompt, esp_console_repl_com_t *repl_com);
esp_err_t esp_console_setup_history(const char *history_path,
uint32_t max_history_len,
esp_console_repl_com_t *repl_com);
uint32_t max_history_len,
esp_console_repl_com_t *repl_com);

View File

@ -40,7 +40,7 @@ size_t esp_console_split_argv(char *line, char **argv, size_t argv_size)
char *next_arg_start = line;
char *out_ptr = line;
for (char *in_ptr = line; argc < argv_size - 1; ++in_ptr) {
int char_in = (unsigned char) *in_ptr;
int char_in = (unsigned char) * in_ptr;
if (char_in == 0) {
break;
}
@ -80,7 +80,7 @@ size_t esp_console_split_argv(char *line, char **argv, size_t argv_size)
} else {
/* unrecognized escape character, skip */
}
state = (split_state_t) (state & (~SS_FLAG_ESCAPE));
state = (split_state_t)(state & (~SS_FLAG_ESCAPE));
break;
case SS_ARG:

View File

@ -25,8 +25,8 @@
*/
typedef struct {
const char *in;
const char *out;
const char *in;
const char *out;
} cmd_context_t;
static esp_console_repl_t *s_repl = NULL;
@ -239,8 +239,8 @@ TEST_CASE("esp console test with context", "[console]")
};
cmd_context_t context1 = {
.in = "c2",
.out = NULL,
.in = "c2",
.out = NULL,
};
const esp_console_cmd_t cmd0 = {
@ -252,11 +252,11 @@ TEST_CASE("esp console test with context", "[console]")
};
const esp_console_cmd_t cmd1 = {
.command = "hello-c2",
.help = "Print Hello World in context c2",
.hint = NULL,
.func_w_context = do_hello_cmd_with_context,
.context = &context1,
.command = "hello-c2",
.help = "Print Hello World in context c2",
.hint = NULL,
.func_w_context = do_hello_cmd_with_context,
.context = &context1,
};
TEST_ESP_OK(esp_console_cmd_register(&cmd0));

View File

@ -49,7 +49,6 @@ components_not_formatted_temporary:
- "/components/bootloader/"
- "/components/bt/"
- "/components/cmock/"
- "/components/console/"
- "/components/efuse/"
- "/components/esp_coex/"
- "/components/esp_eth/"