Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions pygrt/C_extension/src/grt.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,38 @@ print_logo();
printf("\n"
"Usage: \n"
"----------------------------------------------------------------\n"
" grt <submodule name> [options] ...\n\n\n");
" grt [options]\n"
" grt <submodule name> [<submodule-options>] ...\n\n\n"
"Options:\n"
"----------------------------------------------------------------\n"
" -v Display the program version.\n"
"\n"
" -h Display this help message.\n"
"\n\n");
printf("GRT supports the following submodules:\n"
"----------------------------------------------------------------\n");
for (MYINT n = 0; GRT_Submodule_Names[n] != NULL; ++n) {
const char *name = GRT_Submodule_Names[n];
printf(" %-s\n", name);
}
printf("\n\n");
printf("For each submodule, you can use -h to see the help message.\n\n");
printf("\n"
"For each submodule, you can use -h to see its help message, e.g.\n"
" grt greenfn -h \n"
"\n");
}

/** 从命令行中读取选项,处理后记录到参数控制结构体 */
static void getopt_from_command(GRT_MAIN_CTRL *Ctrl, int argc, char **argv){
char* command = Ctrl->name;
int opt;
while ((opt = getopt(argc, argv, ":h")) != -1) {
while ((opt = getopt(argc, argv, ":vh")) != -1) {
switch (opt) {
// 打印版本
case 'v':
printf(GRT_MAIN_COMMAND" %s\n", GRT_VERSION);
exit(EXIT_SUCCESS);
break;

GRT_Common_Options_in_Switch(command, optopt);
}
}
Expand Down
Loading