[TD-6294]<fix>: taosdemo support long arg (#7589)
* [TD-6294]<fix>: taosdemo support long arg fix conflict with develop branch. * fix few words. * declare default child tables number.
This commit is contained in:
parent
dc89fa4830
commit
f159933896
File diff suppressed because it is too large
Load Diff
|
@ -225,7 +225,6 @@ static struct argp_option options[] = {
|
||||||
{"password", 'p', 0, 0, "User password to connect to server. Default is taosdata.", 0},
|
{"password", 'p', 0, 0, "User password to connect to server. Default is taosdata.", 0},
|
||||||
#endif
|
#endif
|
||||||
{"port", 'P', "PORT", 0, "Port to connect", 0},
|
{"port", 'P', "PORT", 0, "Port to connect", 0},
|
||||||
{"cversion", 'v', "CVERION", 0, "client version", 0},
|
|
||||||
{"mysqlFlag", 'q', "MYSQLFLAG", 0, "mysqlFlag, Default is 0", 0},
|
{"mysqlFlag", 'q', "MYSQLFLAG", 0, "mysqlFlag, Default is 0", 0},
|
||||||
// input/output file
|
// input/output file
|
||||||
{"outpath", 'o', "OUTPATH", 0, "Output file path.", 1},
|
{"outpath", 'o', "OUTPATH", 0, "Output file path.", 1},
|
||||||
|
@ -244,7 +243,7 @@ static struct argp_option options[] = {
|
||||||
// dump format options
|
// dump format options
|
||||||
{"schemaonly", 's', 0, 0, "Only dump schema.", 2},
|
{"schemaonly", 's', 0, 0, "Only dump schema.", 2},
|
||||||
{"without-property", 'N', 0, 0, "Dump schema without properties.", 2},
|
{"without-property", 'N', 0, 0, "Dump schema without properties.", 2},
|
||||||
{"avro", 'V', 0, 0, "Dump apache avro format data file. By default, dump sql command sequence.", 2},
|
{"avro", 'v', 0, 0, "Dump apache avro format data file. By default, dump sql command sequence.", 2},
|
||||||
{"start-time", 'S', "START_TIME", 0, "Start time to dump. Either epoch or ISO8601/RFC3339 format is acceptable. ISO8601 format example: 2017-10-01T00:00:00.000+0800 or 2017-10-0100:00:00:000+0800 or '2017-10-01 00:00:00.000+0800'", 4},
|
{"start-time", 'S', "START_TIME", 0, "Start time to dump. Either epoch or ISO8601/RFC3339 format is acceptable. ISO8601 format example: 2017-10-01T00:00:00.000+0800 or 2017-10-0100:00:00:000+0800 or '2017-10-01 00:00:00.000+0800'", 4},
|
||||||
{"end-time", 'E', "END_TIME", 0, "End time to dump. Either epoch or ISO8601/RFC3339 format is acceptable. ISO8601 format example: 2017-10-01T00:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 5},
|
{"end-time", 'E', "END_TIME", 0, "End time to dump. Either epoch or ISO8601/RFC3339 format is acceptable. ISO8601 format example: 2017-10-01T00:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 5},
|
||||||
#if TSDB_SUPPORT_NANOSECOND == 1
|
#if TSDB_SUPPORT_NANOSECOND == 1
|
||||||
|
@ -267,7 +266,6 @@ typedef struct arguments {
|
||||||
char *user;
|
char *user;
|
||||||
char password[SHELL_MAX_PASSWORD_LEN];
|
char password[SHELL_MAX_PASSWORD_LEN];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
char cversion[12];
|
|
||||||
uint16_t mysqlFlag;
|
uint16_t mysqlFlag;
|
||||||
// output file
|
// output file
|
||||||
char outpath[MAX_FILE_NAME_LEN];
|
char outpath[MAX_FILE_NAME_LEN];
|
||||||
|
@ -338,7 +336,6 @@ struct arguments g_args = {
|
||||||
"taosdata",
|
"taosdata",
|
||||||
#endif
|
#endif
|
||||||
0,
|
0,
|
||||||
"",
|
|
||||||
0,
|
0,
|
||||||
// outpath and inpath
|
// outpath and inpath
|
||||||
"",
|
"",
|
||||||
|
@ -395,15 +392,6 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
case 'q':
|
case 'q':
|
||||||
g_args.mysqlFlag = atoi(arg);
|
g_args.mysqlFlag = atoi(arg);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
|
||||||
if (wordexp(arg, &full_path, 0) != 0) {
|
|
||||||
errorPrint("Invalid client vesion %s\n", arg);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
tstrncpy(g_args.cversion, full_path.we_wordv[0], 11);
|
|
||||||
wordfree(&full_path);
|
|
||||||
break;
|
|
||||||
// output file path
|
|
||||||
case 'o':
|
case 'o':
|
||||||
if (wordexp(arg, &full_path, 0) != 0) {
|
if (wordexp(arg, &full_path, 0) != 0) {
|
||||||
errorPrint("Invalid path %s\n", arg);
|
errorPrint("Invalid path %s\n", arg);
|
||||||
|
@ -453,7 +441,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
case 'N':
|
case 'N':
|
||||||
g_args.with_property = false;
|
g_args.with_property = false;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'v':
|
||||||
g_args.avro = true;
|
g_args.avro = true;
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case 'S':
|
||||||
|
@ -660,6 +648,9 @@ static void parse_timestamp(
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
static char verType[32] = {0};
|
||||||
|
sprintf(verType, "version: %s\n", version);
|
||||||
|
argp_program_version = verType;
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
/* Parse our arguments; every option seen by parse_opt will be
|
/* Parse our arguments; every option seen by parse_opt will be
|
||||||
|
@ -686,7 +677,6 @@ int main(int argc, char *argv[]) {
|
||||||
printf("user: %s\n", g_args.user);
|
printf("user: %s\n", g_args.user);
|
||||||
printf("password: %s\n", g_args.password);
|
printf("password: %s\n", g_args.password);
|
||||||
printf("port: %u\n", g_args.port);
|
printf("port: %u\n", g_args.port);
|
||||||
printf("cversion: %s\n", g_args.cversion);
|
|
||||||
printf("mysqlFlag: %d\n", g_args.mysqlFlag);
|
printf("mysqlFlag: %d\n", g_args.mysqlFlag);
|
||||||
printf("outpath: %s\n", g_args.outpath);
|
printf("outpath: %s\n", g_args.outpath);
|
||||||
printf("inpath: %s\n", g_args.inpath);
|
printf("inpath: %s\n", g_args.inpath);
|
||||||
|
@ -715,11 +705,6 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("==============================\n");
|
printf("==============================\n");
|
||||||
|
|
||||||
if (g_args.cversion[0] != 0){
|
|
||||||
tstrncpy(version, g_args.cversion, 11);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (taosCheckParam(&g_args) < 0) {
|
if (taosCheckParam(&g_args) < 0) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -737,7 +722,6 @@ int main(int argc, char *argv[]) {
|
||||||
fprintf(g_fpOfResult, "user: %s\n", g_args.user);
|
fprintf(g_fpOfResult, "user: %s\n", g_args.user);
|
||||||
fprintf(g_fpOfResult, "password: %s\n", g_args.password);
|
fprintf(g_fpOfResult, "password: %s\n", g_args.password);
|
||||||
fprintf(g_fpOfResult, "port: %u\n", g_args.port);
|
fprintf(g_fpOfResult, "port: %u\n", g_args.port);
|
||||||
fprintf(g_fpOfResult, "cversion: %s\n", g_args.cversion);
|
|
||||||
fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag);
|
fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag);
|
||||||
fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath);
|
fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath);
|
||||||
fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath);
|
fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath);
|
||||||
|
|
Loading…
Reference in New Issue