refactor argtable options registration

This commit is contained in:
Данила Горнушко 2023-11-28 17:09:17 +03:00
parent c2ec00dcf2
commit de9ef8984b
2 changed files with 6 additions and 6 deletions

View file

@ -34,7 +34,7 @@ static struct {
} cansend_args; } cansend_args;
static struct { static struct {
struct arg_str *speed; struct arg_int *speed;
struct arg_str *filters; struct arg_str *filters;
struct arg_lit *autorecover; struct arg_lit *autorecover;
struct arg_str *mode; struct arg_str *mode;
@ -182,7 +182,7 @@ static int candown(int argc, char **argv) {
static void register_cansend(void) { static void register_cansend(void) {
cansend_args.message = arg_str1(NULL, NULL, "ID#data", "Message to send, ID and data bytes, all in hex. # is the delimiter."); cansend_args.message = arg_str1(NULL, NULL, "ID#data", "Message to send, ID and data bytes, all in hex. # is the delimiter.");
cansend_args.end = arg_end(1); cansend_args.end = arg_end(2);
const esp_console_cmd_t cmd = { const esp_console_cmd_t cmd = {
.command = "cansend", .command = "cansend",
@ -196,10 +196,10 @@ static void register_cansend(void) {
static void register_canup(void) { static void register_canup(void) {
canup_args.speed = arg_str1(NULL, NULL, "<speed>", "CAN bus speed, in bps. See help for supported speeds."); canup_args.speed = arg_int1(NULL, NULL, "<speed>", "CAN bus speed, in bps. See help for supported speeds.");
canup_args.mode = arg_str0("m", "mode", "<normal|no_ack|listen_only>", "Set CAN mode. Normal (default), No Ack (for self-testing) or Listen Only (to prevent transmitting, for monitoring)."); canup_args.mode = arg_str0("m", "mode", "<normal|no_ack|listen_only>", "Set CAN mode. Normal (default), No Ack (for self-testing) or Listen Only (to prevent transmitting, for monitoring).");
canup_args.filters = arg_str0("f", "filters", "<filters>", "CAN filters to receive only selected frames."); canup_args.filters = arg_str0("f", "filters", "<filters>", "CAN filters to receive only selected frames.");
canup_args.autorecover = arg_litn("r", "auto-recovery", 0, 1, "Set to enable auto-recovery of CAN bus if case of bus-off event"); canup_args.autorecover = arg_lit0("r", "auto-recovery", "Set to enable auto-recovery of CAN bus if case of bus-off event");
canup_args.end = arg_end(4); canup_args.end = arg_end(4);
const esp_console_cmd_t cmd = { const esp_console_cmd_t cmd = {

View file

@ -39,8 +39,8 @@ static int timestamp(int argc, char **argv) {
static void register_timestamp(void) { static void register_timestamp(void) {
timestamp_args.disable = arg_litn("d", "disable", 0, 1, "Set to disable timestamps."); timestamp_args.disable = arg_lit0("d", "disable", "Set to disable timestamps.");
timestamp_args.end = arg_end(1); timestamp_args.end = arg_end(2);
const esp_console_cmd_t cmd = { const esp_console_cmd_t cmd = {
.command = "timestamp", .command = "timestamp",