提交 a6dda144 编写于 作者: A Alex Duan

feat(shell): support maxos autotab

上级 199dbab9
......@@ -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)
......
......@@ -118,6 +118,7 @@ SWords shellCommands[] = {
{"show variables;", 0, 0, NULL},
{"show vgroups;", 0, 0, NULL},
{"insert into <tb_name> values(", 0, 0, NULL},
{"insert into <tb_name> using <stb_name> tags(", 0, 0, NULL},
{"use <db_name>", 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
......
......@@ -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;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册