fix: adjust show text and format

This commit is contained in:
Alex Duan 2024-11-28 16:48:09 +08:00
parent 42b4bc97de
commit 5882d6bbe7
4 changed files with 6 additions and 9 deletions

View File

@ -48,7 +48,7 @@
#define SHELL_FLOAT_WIDTH 20 #define SHELL_FLOAT_WIDTH 20
#define SHELL_DOUBLE_WIDTH 25 #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 { typedef struct {
char* hist[SHELL_MAX_HISTORY_SIZE]; char* hist[SHELL_MAX_HISTORY_SIZE];
char file[TSDB_FILENAME_LEN]; char file[TSDB_FILENAME_LEN];

View File

@ -92,7 +92,6 @@ void shellPrintHelp() {
#else #else
printf("\r\n\r\nReport bugs to %s.\r\n", "support@taosdata.com"); printf("\r\n\r\nReport bugs to %s.\r\n", "support@taosdata.com");
#endif #endif
printf("%s", ERROR_CODE_DETAIL);
} }
#ifdef LINUX #ifdef LINUX
#include <argp.h> #include <argp.h>
@ -104,9 +103,9 @@ void shellPrintHelp() {
const char *argp_program_version = td_version; const char *argp_program_version = td_version;
#ifdef CUS_EMAIL #ifdef CUS_EMAIL
const char *argp_program_bug_address = CUS_EMAIL ERROR_CODE_DETAIL; const char *argp_program_bug_address = CUS_EMAIL;
#else #else
const char *argp_program_bug_address = "support@taosdata.com "ERROR_CODE_DETAIL; const char *argp_program_bug_address = "support@taosdata.com;
#endif #endif
static struct argp_option shellOptions[] = { static struct argp_option shellOptions[] = {

View File

@ -662,7 +662,6 @@ void showHelp() {
now - current time \n\ now - current time \n\
Example : \n\ Example : \n\
select * from t1 where ts > now - 2w + 3d and ts <= now - 1w -2h ;\n"); select * from t1 where ts > now - 2w + 3d and ts <= now - 1w -2h ;\n");
printf(ERROR_CODE_DETAIL);
printf("\n"); printf("\n");
} }

View File

@ -1091,7 +1091,7 @@ void shellCleanupHistory() {
void shellPrintError(TAOS_RES *tres, int64_t st) { void shellPrintError(TAOS_RES *tres, int64_t st) {
int64_t et = taosGetTimestampUs(); 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); taos_free_result(tres);
} }
@ -1303,8 +1303,7 @@ int32_t shellExecute() {
#ifdef WEBSOCKET #ifdef WEBSOCKET
if (shell.args.restful || shell.args.cloud) { if (shell.args.restful || shell.args.cloud) {
if (shell_conn_ws_server(1)) { 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("failed to connect to server, reason: %s[0x%08X]\n%s", ws_errstr(NULL), ws_errno(NULL), ERROR_CODE_DETAIL);
printf(ERROR_CODE_DETAIL);
fflush(stdout); fflush(stdout);
return -1; return -1;
} }
@ -1317,7 +1316,7 @@ int32_t shellExecute() {
} }
if (shell.conn == NULL) { 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); fflush(stdout);
return -1; return -1;
} }