feat: v0.2.0
This commit is contained in:
22
tests/test_subcommand.c
Normal file
22
tests/test_subcommand.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "ArgParse.h"
|
||||
#include "initArgParse.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
ArgParse *argparse = initArgParse();
|
||||
|
||||
argParseParse(argparse, argc, argv);
|
||||
|
||||
|
||||
char *command_name = argParseGetCurCommandName(argparse);
|
||||
printf("command name: %s\n", command_name);
|
||||
assert(strcmp(command_name, "tools") == 0);
|
||||
|
||||
char * val = argParseGetCurArg(argparse, "-t");
|
||||
printf("tools -t: %s\n", val);
|
||||
|
||||
argParseFree(argparse);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user