Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a6dda144
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a6dda144
编写于
7月 16, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(shell): support maxos autotab
上级
199dbab9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
10 deletion
+18
-10
src/kit/shell/CMakeLists.txt
src/kit/shell/CMakeLists.txt
+2
-0
src/kit/shell/src/shellAuto.c
src/kit/shell/src/shellAuto.c
+5
-7
src/kit/shell/src/shellDarwin.c
src/kit/shell/src/shellDarwin.c
+11
-3
未找到文件。
src/kit/shell/CMakeLists.txt
浏览文件 @
a6dda144
...
@@ -46,6 +46,8 @@ ELSEIF (TD_DARWIN)
...
@@ -46,6 +46,8 @@ ELSEIF (TD_DARWIN)
LIST
(
APPEND SRC ./src/shellCommand.c
)
LIST
(
APPEND SRC ./src/shellCommand.c
)
LIST
(
APPEND SRC ./src/shellImport.c
)
LIST
(
APPEND SRC ./src/shellImport.c
)
LIST
(
APPEND SRC ./src/shellCheck.c
)
LIST
(
APPEND SRC ./src/shellCheck.c
)
LIST
(
APPEND SRC ./src/shellAuto.c
)
LIST
(
APPEND SRC ./src/tire.c
)
ADD_EXECUTABLE
(
shell
${
SRC
}
)
ADD_EXECUTABLE
(
shell
${
SRC
}
)
# linking with dylib
# linking with dylib
TARGET_LINK_LIBRARIES
(
shell taos cJson
)
TARGET_LINK_LIBRARIES
(
shell taos cJson
)
...
...
src/kit/shell/src/shellAuto.c
浏览文件 @
a6dda144
...
@@ -118,6 +118,7 @@ SWords shellCommands[] = {
...
@@ -118,6 +118,7 @@ SWords shellCommands[] = {
{
"show variables;"
,
0
,
0
,
NULL
},
{
"show variables;"
,
0
,
0
,
NULL
},
{
"show vgroups;"
,
0
,
0
,
NULL
},
{
"show vgroups;"
,
0
,
0
,
NULL
},
{
"insert into <tb_name> values("
,
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
}
{
"use <db_name>"
,
0
,
0
,
NULL
}
};
};
...
@@ -227,14 +228,14 @@ char * db_options[] = {
...
@@ -227,14 +228,14 @@ char * db_options[] = {
char
*
data_types
[]
=
{
char
*
data_types
[]
=
{
"timestamp"
,
"timestamp"
,
"int"
,
"int"
,
"bigint"
,
"float"
,
"float"
,
"double"
,
"double"
,
"binary"
,
"binary(16)"
,
"nchar(16)"
,
"bigint"
,
"smallint"
,
"smallint"
,
"tinyint"
,
"tinyint"
,
"bool"
,
"bool"
,
"nchar"
,
"json"
"json"
};
};
...
@@ -564,7 +565,7 @@ bool shellAutoInit() {
...
@@ -564,7 +565,7 @@ bool shellAutoInit() {
pthread_mutex_init
(
&
tiresMutex
,
NULL
);
pthread_mutex_init
(
&
tiresMutex
,
NULL
);
// threads
// threads
memset
(
threads
,
0
,
sizeof
(
pthread_t
*
)
*
WT_
VAR
_CNT
);
memset
(
threads
,
0
,
sizeof
(
pthread_t
*
)
*
WT_
FROM_DB
_CNT
);
// generate varType
// generate varType
GenerateVarType
(
WT_VAR_FUNC
,
functions
,
sizeof
(
functions
)
/
sizeof
(
char
*
));
GenerateVarType
(
WT_VAR_FUNC
,
functions
,
sizeof
(
functions
)
/
sizeof
(
char
*
));
...
@@ -1535,9 +1536,6 @@ void pressOtherKey(char c) {
...
@@ -1535,9 +1536,6 @@ void pressOtherKey(char c) {
freeMatch
(
lastMatch
);
freeMatch
(
lastMatch
);
lastMatch
=
NULL
;
lastMatch
=
NULL
;
}
}
//printf(" -> %d <-\n", c);
}
}
// put name into name, return name length
// put name into name, return name length
...
...
src/kit/shell/src/shellDarwin.c
浏览文件 @
a6dda144
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "tkey.h"
#include "tkey.h"
#include "tscLog.h"
#include "tscLog.h"
#include "shellAuto.h"
#define OPT_ABORT 1
/* �Cabort */
#define OPT_ABORT 1
/* �Cabort */
...
@@ -255,7 +256,12 @@ int32_t shellReadCommand(TAOS *con, char *command) {
...
@@ -255,7 +256,12 @@ int32_t shellReadCommand(TAOS *con, char *command) {
utf8_array
[
k
]
=
c
;
utf8_array
[
k
]
=
c
;
}
}
insertChar
(
&
cmd
,
utf8_array
,
count
);
insertChar
(
&
cmd
,
utf8_array
,
count
);
pressOtherKey
(
c
);
}
else
if
(
c
==
TAB_KEY
)
{
// press TAB key
pressTabKey
(
con
,
&
cmd
);
}
else
if
(
c
<
'\033'
)
{
}
else
if
(
c
<
'\033'
)
{
pressOtherKey
(
c
);
// Ctrl keys. TODO: Implement ctrl combinations
// Ctrl keys. TODO: Implement ctrl combinations
switch
(
c
)
{
switch
(
c
)
{
case
1
:
// ctrl A
case
1
:
// ctrl A
...
@@ -377,9 +383,11 @@ int32_t shellReadCommand(TAOS *con, char *command) {
...
@@ -377,9 +383,11 @@ int32_t shellReadCommand(TAOS *con, char *command) {
break
;
break
;
}
}
}
else
if
(
c
==
0x7f
)
{
}
else
if
(
c
==
0x7f
)
{
pressOtherKey
(
c
);
// press delete key
// press delete key
backspaceChar
(
&
cmd
);
backspaceChar
(
&
cmd
);
}
else
{
}
else
{
pressOtherKey
(
c
);
insertChar
(
&
cmd
,
&
c
,
1
);
insertChar
(
&
cmd
,
&
c
,
1
);
}
}
}
}
...
@@ -528,14 +536,14 @@ void showOnScreen(Command *cmd) {
...
@@ -528,14 +536,14 @@ void showOnScreen(Command *cmd) {
/* assert(size >= 0); */
/* assert(size >= 0); */
int
width
=
wcwidth
(
wc
);
int
width
=
wcwidth
(
wc
);
if
(
remain_column
>
width
)
{
if
(
remain_column
>
width
)
{
printf
(
"%lc"
,
wc
);
fprintf
(
stdout
,
"%lc"
,
wc
);
remain_column
-=
width
;
remain_column
-=
width
;
}
else
{
}
else
{
if
(
remain_column
==
width
)
{
if
(
remain_column
==
width
)
{
printf
(
"%lc
\n\r
"
,
wc
);
fprintf
(
stdout
,
"%lc
\n\r
"
,
wc
);
remain_column
=
w
.
ws_col
;
remain_column
=
w
.
ws_col
;
}
else
{
}
else
{
printf
(
"
\n\r
%lc"
,
wc
);
fprintf
(
stdout
,
"
\n\r
%lc"
,
wc
);
remain_column
=
w
.
ws_col
-
width
;
remain_column
=
w
.
ws_col
-
width
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录