mirror of
https://github.com/pine64/blisp.git
synced 2025-05-14 12:17:12 +00:00
Another improvements
This commit is contained in:
parent
019c7dd845
commit
542efae1db
@ -14,7 +14,7 @@ cmd_write_args_init() {
|
|||||||
cmd_write_argtable[0] = cmd
|
cmd_write_argtable[0] = cmd
|
||||||
= arg_rex1(NULL, NULL, "write", NULL, REG_ICASE, NULL);
|
= arg_rex1(NULL, NULL, "write", NULL, REG_ICASE, NULL);
|
||||||
cmd_write_argtable[1] = binary_to_write
|
cmd_write_argtable[1] = binary_to_write
|
||||||
= arg_file0(NULL, NULL, "<input>", "Binary to write");
|
= arg_file1(NULL, NULL, "<input>", "Binary to write");
|
||||||
cmd_write_argtable[2] = end = arg_end(10);
|
cmd_write_argtable[2] = end = arg_end(10);
|
||||||
|
|
||||||
if (arg_nullcheck(cmd_write_argtable) != 0) {
|
if (arg_nullcheck(cmd_write_argtable) != 0) {
|
||||||
@ -23,12 +23,22 @@ cmd_write_args_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmd_write_args_print_glossary() {
|
||||||
|
fputs("Usage: blisp", stdout);
|
||||||
|
arg_print_syntax(stdout,cmd_write_argtable,"\n");
|
||||||
|
puts("Writes firmware to SPI Flash");
|
||||||
|
arg_print_glossary(stdout,cmd_write_argtable," %-25s %s\n");
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
cmd_write_parse_exec(int argc, char** argv) {
|
cmd_write_parse_exec(int argc, char** argv) {
|
||||||
int errors = arg_parse(argc, argv, cmd_write_argtable);
|
int errors = arg_parse(argc, argv, cmd_write_argtable);
|
||||||
if (errors == 0) {
|
if (errors == 0) {
|
||||||
printf("yeet\n");
|
printf("yeet\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
} else if (cmd->count == 1) {
|
||||||
|
cmd_write_args_print_glossary();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -22,15 +22,17 @@ int8_t args_init() {
|
|||||||
fprintf(stderr, "insufficient memory\n");
|
fprintf(stderr, "insufficient memory\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_help() {
|
void print_help() {
|
||||||
puts("Usage:");
|
puts("Usage:");
|
||||||
for (uint8_t i = 0; cmds[i] != NULL; i++) {
|
for (uint8_t i = 0; cmds[i] != NULL; i++) {
|
||||||
fputs("\tblisp", stdout);
|
fputs(" blisp", stdout);
|
||||||
cmds[i]->args_print_syntax();
|
cmds[i]->args_print_syntax();
|
||||||
}
|
}
|
||||||
fputs("\tblisp", stdout);
|
fputs(" blisp", stdout);
|
||||||
arg_print_syntax(stdout, argtable,"\n");
|
arg_print_syntax(stdout, argtable,"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!command_found) {
|
if (!command_found) {
|
||||||
|
print_help();
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
Loading…
Reference in New Issue
Block a user