diff --git a/src/kit/shell/CMakeLists.txt b/src/kit/shell/CMakeLists.txt index b311361c438d033ad3f7582d30df7d1c33357c1d..614fa328bae1f0ad32917da6b08dc372a8d696a2 100644 --- a/src/kit/shell/CMakeLists.txt +++ b/src/kit/shell/CMakeLists.txt @@ -46,6 +46,8 @@ ELSEIF (TD_DARWIN) LIST(APPEND SRC ./src/shellCommand.c) LIST(APPEND SRC ./src/shellImport.c) LIST(APPEND SRC ./src/shellCheck.c) + LIST(APPEND SRC ./src/shellAuto.c) + LIST(APPEND SRC ./src/tire.c) ADD_EXECUTABLE(shell ${SRC}) # linking with dylib TARGET_LINK_LIBRARIES(shell taos cJson) diff --git a/src/kit/shell/src/shellAuto.c b/src/kit/shell/src/shellAuto.c index 7ac120156cca8760892b41316018516b6e1161fc..8b695663290f91ec42bf11157786ba1fd2c8a965 100644 --- a/src/kit/shell/src/shellAuto.c +++ b/src/kit/shell/src/shellAuto.c @@ -118,6 +118,7 @@ SWords shellCommands[] = { {"show variables;", 0, 0, NULL}, {"show vgroups;", 0, 0, NULL}, {"insert into values(", 0, 0, NULL}, + {"insert into using tags(", 0, 0, NULL}, {"use ", 0, 0, NULL} }; @@ -227,14 +228,14 @@ char * db_options[] = { char * data_types[] = { "timestamp", "int", - "bigint", "float", "double", - "binary", + "binary(16)", + "nchar(16)", + "bigint", "smallint", "tinyint", "bool", - "nchar", "json" }; @@ -564,7 +565,7 @@ bool shellAutoInit() { pthread_mutex_init(&tiresMutex, NULL); // threads - memset(threads, 0, sizeof(pthread_t*) * WT_VAR_CNT); + memset(threads, 0, sizeof(pthread_t*) * WT_FROM_DB_CNT); // generate varType GenerateVarType(WT_VAR_FUNC, functions, sizeof(functions) /sizeof(char *)); @@ -1535,9 +1536,6 @@ void pressOtherKey(char c) { freeMatch(lastMatch); lastMatch = NULL; } - - //printf(" -> %d <-\n", c); - } // put name into name, return name length diff --git a/src/kit/shell/src/shellDarwin.c b/src/kit/shell/src/shellDarwin.c index 7803113a0f98f0152c0ab6da948252064c33c70d..fa3afd131af1dd566dfafc032e938ae6cf45355c 100644 --- a/src/kit/shell/src/shellDarwin.c +++ b/src/kit/shell/src/shellDarwin.c @@ -22,6 +22,7 @@ #include "tkey.h" #include "tscLog.h" +#include "shellAuto.h" #define OPT_ABORT 1 /* �Cabort */ @@ -255,7 +256,12 @@ int32_t shellReadCommand(TAOS *con, char *command) { utf8_array[k] = c; } insertChar(&cmd, utf8_array, count); + pressOtherKey(c); + } else if (c == TAB_KEY) { + // press TAB key + pressTabKey(con, &cmd); } else if (c < '\033') { + pressOtherKey(c); // Ctrl keys. TODO: Implement ctrl combinations switch (c) { case 1: // ctrl A @@ -377,9 +383,11 @@ int32_t shellReadCommand(TAOS *con, char *command) { break; } } else if (c == 0x7f) { + pressOtherKey(c); // press delete key backspaceChar(&cmd); } else { + pressOtherKey(c); insertChar(&cmd, &c, 1); } } @@ -528,14 +536,14 @@ void showOnScreen(Command *cmd) { /* assert(size >= 0); */ int width = wcwidth(wc); if (remain_column > width) { - printf("%lc", wc); + fprintf(stdout, "%lc", wc); remain_column -= width; } else { if (remain_column == width) { - printf("%lc\n\r", wc); + fprintf(stdout, "%lc\n\r", wc); remain_column = w.ws_col; } else { - printf("\n\r%lc", wc); + fprintf(stdout, "\n\r%lc", wc); remain_column = w.ws_col - width; } }