Yecheng Fu

Results 47 comments of Yecheng Fu

https://github.com/cofyc/argparse/blob/c612dc03958cdbd538ca306d61853b643a435933/tests/basic.c#L19-L22 You can initialize variables with default values. If no arguments provided, the default values will not be overridden.

do you have a design?

no builtin support, implement via callback? add a raw opt type with which users can write any logic to parse opt value?

no builtin support, but it's easy to implement, e.g. ``` struct cmd_struct { const char *cmd; int len; int (*fn) (int, const char **); const char *help; }; static struct...

no, however you can follow [this example](https://github.com/cofyc/argparse/issues/34#issuecomment-688235399)

I also create a full example here: https://github.com/cofyc/argparse/blob/master/tests/subcommands.c

If you need to parse arguments for subcommand, you can init and config `argparse` to parse arguments in the same way as in the main program.

the example is updated, see the [latest version](https://github.com/cofyc/argparse/blob/master/tests/subcommands.c). Note that `ARGPARSE_STOP_AT_NON_OPTION` must be passed to `argparse_init` in the main program.