From 4093649309df0f201fafafa4c5830e234fb5dd03 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 30 Dec 2022 13:06:21 +0800 Subject: [PATCH] chore: use brand name instead --- tools/shell/inc/shellInt.h | 5 +++-- tools/shell/src/shellArguments.c | 24 ++++++++++++++++++------ tools/shell/src/shellAuto.c | 4 ++-- tools/shell/src/shellEngine.c | 3 ++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/tools/shell/inc/shellInt.h b/tools/shell/inc/shellInt.h index af724c1533..a27dc0536d 100644 --- a/tools/shell/inc/shellInt.h +++ b/tools/shell/inc/shellInt.h @@ -80,8 +80,9 @@ typedef struct { } SShellArgs; typedef struct { - const char* clientVersion; - const char* promptHeader; + const char *clientVersion; + char brandName[32]; + char promptHeader[32]; const char* promptContinue; const char* osname; int32_t promptSize; diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 0911b60e9d..5841a8296f 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -19,7 +19,18 @@ #include "shellInt.h" -#define TAOS_CONSOLE_PROMPT_HEADER "taos> " +#ifndef OEM_BRAND + char brandName[] = "TDengine"; +#else + char brandName[] = OEM_BRAND; +#endif + +#ifndef OEM_PROMPT + char brandPrompt[] = "taos"; +#else + char brandPrompt[] = OEM_PROMPT; +#endif + #define TAOS_CONSOLE_PROMPT_CONTINUE " -> " #define SHELL_HOST "The server FQDN to connect. The default host is localhost." @@ -388,12 +399,13 @@ static int32_t shellCheckArgs() { int32_t shellParseArgs(int32_t argc, char *argv[]) { shellInitArgs(argc, argv); - shell.info.clientVersion = - "Welcome to the TDengine Command Line Interface, Client Version:%s\r\n" - "Copyright (c) 2022 by TDengine, all rights reserved.\r\n\r\n"; - shell.info.promptHeader = TAOS_CONSOLE_PROMPT_HEADER; + shell.info.clientVersion = + "Welcome to the %s Command Line Interface, Client Version:%s\r\n" + "Copyright (c) 2022 by %s, all rights reserved.\r\n\r\n"; + strcpy(shell.info.brandName, brandName); + sprintf(shell.info.promptHeader, "%s> ", brandPrompt); shell.info.promptContinue = TAOS_CONSOLE_PROMPT_CONTINUE; - shell.info.promptSize = 6; + shell.info.promptSize = strlen(shell.info.promptHeader); snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "version: %s", version); #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) diff --git a/tools/shell/src/shellAuto.c b/tools/shell/src/shellAuto.c index b391d59725..d85a81cb3a 100644 --- a/tools/shell/src/shellAuto.c +++ b/tools/shell/src/shellAuto.c @@ -328,7 +328,7 @@ int cntDel = 0; // delete byte count after next press tab // show auto tab introduction void printfIntroduction() { printf(" ****************************** Tab Completion **********************************\n"); - printf(" * The TDengine CLI supports tab completion for a variety of items, *\n"); + printf(" * The %s CLI supports tab completion for a variety of items, *\n", shell.info.brandName); printf(" * including database names, table names, function names and keywords. *\n"); printf(" * The full list of shortcut keys is as follows: *\n"); printf(" * [ TAB ] ...... complete the current word *\n"); @@ -343,7 +343,7 @@ void printfIntroduction() { } void showHelp() { - printf("\nThe TDengine CLI supports the following commands:"); + printf("\nThe %s CLI supports the following commands:", shell.info.brandName); printf( "\n\ ----- A ----- \n\ diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 986806fdd8..f4544b5042 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1072,7 +1072,8 @@ void *shellThreadLoop(void *arg) { } int32_t shellExecute() { - printf(shell.info.clientVersion, taos_get_client_info()); + printf(shell.info.clientVersion, shell.info.brandName, + taos_get_client_info(), shell.info.brandName); fflush(stdout); SShellArgs *pArgs = &shell.args; -- GitLab