style: 格式化代码对齐和参数布局

This commit is contained in:
2025-09-30 10:16:42 +08:00
parent 56a50201fe
commit 0a7179380a
2 changed files with 33 additions and 12 deletions

View File

@@ -819,9 +819,9 @@ bool argParseCheckCommandTriggered(ArgParse *argParse, char *command_name) {
}
NORETURN void argParseError(ArgParse *argParse,
Command *lastCommand,
const char *prefix,
const char *suffix) {
Command *lastCommand,
const char *prefix,
const char *suffix) {
if (argParse == NULL) {
printf("ERROR: Parse is NULL\n");
exit(1);

View File

@@ -4,7 +4,7 @@
#include <string.h>
ArgParse *initArgParse() {
ArgParse *argparse = argParseInit("测试程序",ArgParseNOVALUE);
ArgParse *argparse = argParseInit("测试程序", ArgParseNOVALUE);
Command *command = NULL;
Command *sub_command = NULL;
@@ -17,12 +17,23 @@ ArgParse *initArgParse() {
NULL,
false,
ArgParseNOVALUE);
argParseAddGlobalArg(
argparse, "-q", "--quiet", "Quiet mode", NULL, NULL, false, ArgParseNOVALUE);
argParseAddGlobalArg(argparse,
"-q",
"--quiet",
"Quiet mode",
NULL,
NULL,
false,
ArgParseNOVALUE);
// add arguments
command = argParseAddCommand(
argparse, "install", "Install the package", NULL, NULL, NULL, ArgParseNOVALUE);
command = argParseAddCommand(argparse,
"install",
"Install the package",
NULL,
NULL,
NULL,
ArgParseNOVALUE);
argParseAddArg(command,
"-i",
"--index",
@@ -48,8 +59,13 @@ ArgParse *initArgParse() {
false,
ArgParseMULTIVALUE);
sub_command = argParseAddSubCommand(
command, "tools", "Install tools", NULL, NULL, NULL, ArgParseMULTIVALUE);
sub_command = argParseAddSubCommand(command,
"tools",
"Install tools",
NULL,
NULL,
NULL,
ArgParseMULTIVALUE);
argParseAddArg(sub_command,
"-t",
@@ -59,8 +75,13 @@ ArgParse *initArgParse() {
NULL,
true,
ArgParseMULTIVALUE);
sub_command = argParseAddSubCommand(
command, "tools_sub", "Install tools", NULL, NULL, NULL, ArgParseMULTIVALUE);
sub_command = argParseAddSubCommand(command,
"tools_sub",
"Install tools",
NULL,
NULL,
NULL,
ArgParseMULTIVALUE);
argParseAddArg(sub_command,
"-s",