From 5882d6bbe7ec207d5245214bb290c8cbcd419d2e Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Thu, 28 Nov 2024 16:48:09 +0800 Subject: [PATCH] fix: adjust show text and format --- tools/shell/inc/shellInt.h | 2 +- tools/shell/src/shellArguments.c | 5 ++--- tools/shell/src/shellAuto.c | 1 - tools/shell/src/shellEngine.c | 7 +++---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/shell/inc/shellInt.h b/tools/shell/inc/shellInt.h index 6d372ec559..e1efd3cf95 100644 --- a/tools/shell/inc/shellInt.h +++ b/tools/shell/inc/shellInt.h @@ -48,7 +48,7 @@ #define SHELL_FLOAT_WIDTH 20 #define SHELL_DOUBLE_WIDTH 25 -#define ERROR_CODE_DETAIL "\r\n\r\nView possible causes and suggested actions for error codes: \r\n https://docs.taosdata.com/reference/error-code/\r\n" +#define ERROR_CODE_DETAIL "\r\n\r\nView possible causes and suggested actions for error codes, \r\nplease refer to page of 'Reference'-> 'Error Codes' on TDengine's official website./\r\n" typedef struct { char* hist[SHELL_MAX_HISTORY_SIZE]; char file[TSDB_FILENAME_LEN]; diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 50520b8f65..09e7e035c0 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -92,7 +92,6 @@ void shellPrintHelp() { #else printf("\r\n\r\nReport bugs to %s.\r\n", "support@taosdata.com"); #endif - printf("%s", ERROR_CODE_DETAIL); } #ifdef LINUX #include @@ -104,9 +103,9 @@ void shellPrintHelp() { const char *argp_program_version = td_version; #ifdef CUS_EMAIL -const char *argp_program_bug_address = CUS_EMAIL ERROR_CODE_DETAIL; +const char *argp_program_bug_address = CUS_EMAIL; #else -const char *argp_program_bug_address = "support@taosdata.com "ERROR_CODE_DETAIL; +const char *argp_program_bug_address = "support@taosdata.com; #endif static struct argp_option shellOptions[] = { diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index 9fc929a595..959e2d6d62 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -662,7 +662,6 @@ void showHelp() { now - current time \n\ Example : \n\ select * from t1 where ts > now - 2w + 3d and ts <= now - 1w -2h ;\n"); - printf(ERROR_CODE_DETAIL); printf("\n"); } diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 0427868754..7328b67dff 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1091,7 +1091,7 @@ void shellCleanupHistory() { void shellPrintError(TAOS_RES *tres, int64_t st) { int64_t et = taosGetTimestampUs(); - fprintf(stderr, "\r\nDB error:0x%08X %s (%.6fs)\r\n", taos_errno(tres), taos_errstr(tres), (et - st) / 1E6); + fprintf(stderr, "\r\nDB error: %s[0x%08X] (%.6fs)\r\n", taos_errstr(tres), taos_errno(tres), (et - st) / 1E6); taos_free_result(tres); } @@ -1303,8 +1303,7 @@ int32_t shellExecute() { #ifdef WEBSOCKET if (shell.args.restful || shell.args.cloud) { if (shell_conn_ws_server(1)) { - printf("failed to connect to server, code:0x%08X %s\n%s", ws_errno(NULL), ws_errstr(NULL), ERROR_CODE_DETAIL); - printf(ERROR_CODE_DETAIL); + printf("failed to connect to server, reason: %s[0x%08X]\n%s", ws_errstr(NULL), ws_errno(NULL), ERROR_CODE_DETAIL); fflush(stdout); return -1; } @@ -1317,7 +1316,7 @@ int32_t shellExecute() { } if (shell.conn == NULL) { - printf("failed to connect to server, code:0x%08X %s\n%s", taos_errno(NULL), taos_errstr(NULL), ERROR_CODE_DETAIL); + printf("failed to connect to server, reason: %s[0x%08X]\n%s", taos_errstr(NULL), taos_errno(NULL), ERROR_CODE_DETAIL); fflush(stdout); return -1; }