Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
7259c0a6
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7259c0a6
编写于
10月 02, 2021
作者:
A
AlexDuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init source
上级
7f9169ca
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
97 addition
and
6 deletion
+97
-6
src/kit/shell/inc/autoTab.h
src/kit/shell/inc/autoTab.h
+30
-0
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+3
-0
src/kit/shell/src/autoTab.c
src/kit/shell/src/autoTab.c
+54
-0
src/kit/shell/src/shellDarwin.c
src/kit/shell/src/shellDarwin.c
+2
-2
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+5
-2
src/kit/shell/src/shellMain.c
src/kit/shell/src/shellMain.c
+1
-0
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+2
-2
未找到文件。
src/kit/shell/inc/autoTab.h
0 → 100644
浏览文件 @
7259c0a6
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __AUTOTAB__
#define __AUTOTAB__
#include "taos.h"
#include "shellCommand.h"
// main entry
void
pressTabKey
(
TAOS
*
con
,
Command
*
pcmd
);
// show help
void
showHelp
();
// auto filling match words with pre
void
autoFilling
(
char
*
pre
,
TAOS
*
conn
,
Command
*
pcmd
);
#endif
src/kit/shell/inc/shell.h
浏览文件 @
7259c0a6
...
@@ -27,10 +27,13 @@
...
@@ -27,10 +27,13 @@
#define MAX_IP_SIZE 20
#define MAX_IP_SIZE 20
#define MAX_HISTORY_SIZE 1000
#define MAX_HISTORY_SIZE 1000
#define MAX_COMMAND_SIZE 1048586
#define MAX_COMMAND_SIZE 1048586
#define DOUBLE_COMMAND_SIZE 2*MAX_COMMAND_SIZE
#define HISTORY_FILE ".taos_history"
#define HISTORY_FILE ".taos_history"
#define DEFAULT_RES_SHOW_NUM 100
#define DEFAULT_RES_SHOW_NUM 100
#define TAB_KEY 9
typedef
struct
SShellHistory
{
typedef
struct
SShellHistory
{
char
*
hist
[
MAX_HISTORY_SIZE
];
char
*
hist
[
MAX_HISTORY_SIZE
];
int
hstart
;
int
hstart
;
...
...
src/kit/shell/src/autoTab.c
0 → 100644
浏览文件 @
7259c0a6
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _BSD_SOURCE
#define _GNU_SOURCE
#define _XOPEN_SOURCE
#define _DEFAULT_SOURCE
#include "autoTab.h"
#include "os.h"
#include "shellCommand.h"
// main entry
void
pressTabKey
(
TAOS
*
con
,
Command
*
pcmd
)
{
if
(
pcmd
->
commandSize
==
0
)
{
// insert help
showHelp
();
showOnScreen
(
pcmd
);
}
else
{
autoFilling
(
pcmd
->
command
,
con
,
pcmd
);
}
}
void
autoFilling
(
char
*
pre
,
TAOS
*
conn
,
Command
*
pcmd
)
{
// first level
// second level
}
void
showHelp
()
{
printf
(
"You can run below command:
\n
"
);
printf
(
" create database
\n
"
);
printf
(
" create table
\n
"
);
printf
(
" show databases
\n
"
);
printf
(
" use databases
\n
"
);
printf
(
" describe table
\n
"
);
}
src/kit/shell/src/shellDarwin.c
浏览文件 @
7259c0a6
...
@@ -368,7 +368,7 @@ void *shellLoopQuery(void *arg) {
...
@@ -368,7 +368,7 @@ void *shellLoopQuery(void *arg) {
pthread_cleanup_push
(
cleanup_handler
,
NULL
);
pthread_cleanup_push
(
cleanup_handler
,
NULL
);
char
*
command
=
malloc
(
MAX
_COMMAND_SIZE
);
char
*
command
=
malloc
(
DOUBLE
_COMMAND_SIZE
);
if
(
command
==
NULL
){
if
(
command
==
NULL
){
tscError
(
"failed to malloc command"
);
tscError
(
"failed to malloc command"
);
return
NULL
;
return
NULL
;
...
@@ -378,7 +378,7 @@ void *shellLoopQuery(void *arg) {
...
@@ -378,7 +378,7 @@ void *shellLoopQuery(void *arg) {
do
{
do
{
// Read command from shell.
// Read command from shell.
memset
(
command
,
0
,
MAX
_COMMAND_SIZE
);
memset
(
command
,
0
,
DOUBLE
_COMMAND_SIZE
);
set_terminal_mode
();
set_terminal_mode
();
err
=
shellReadCommand
(
con
,
command
);
err
=
shellReadCommand
(
con
,
command
);
if
(
err
)
{
if
(
err
)
{
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
7259c0a6
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "shellCommand.h"
#include "shellCommand.h"
#include "tkey.h"
#include "tkey.h"
#include "tulog.h"
#include "tulog.h"
#include "autoTab.h"
#define OPT_ABORT 1
/* �Cabort */
#define OPT_ABORT 1
/* �Cabort */
...
@@ -239,6 +240,8 @@ int32_t shellReadCommand(TAOS *con, char *command) {
...
@@ -239,6 +240,8 @@ int32_t shellReadCommand(TAOS *con, char *command) {
if
(
c
==
EOF
)
{
if
(
c
==
EOF
)
{
return
c
;
return
c
;
}
else
if
(
c
==
TAB_KEY
)
{
pressTabKey
(
con
,
&
cmd
);
}
}
if
(
c
<
0
)
{
// For UTF-8
if
(
c
<
0
)
{
// For UTF-8
...
@@ -393,7 +396,7 @@ void *shellLoopQuery(void *arg) {
...
@@ -393,7 +396,7 @@ void *shellLoopQuery(void *arg) {
pthread_cleanup_push
(
cleanup_handler
,
NULL
);
pthread_cleanup_push
(
cleanup_handler
,
NULL
);
char
*
command
=
malloc
(
MAX
_COMMAND_SIZE
);
char
*
command
=
malloc
(
DOUBLE
_COMMAND_SIZE
);
if
(
command
==
NULL
){
if
(
command
==
NULL
){
uError
(
"failed to malloc command"
);
uError
(
"failed to malloc command"
);
return
NULL
;
return
NULL
;
...
@@ -403,7 +406,7 @@ void *shellLoopQuery(void *arg) {
...
@@ -403,7 +406,7 @@ void *shellLoopQuery(void *arg) {
do
{
do
{
// Read command from shell.
// Read command from shell.
memset
(
command
,
0
,
MAX
_COMMAND_SIZE
);
memset
(
command
,
0
,
DOUBLE
_COMMAND_SIZE
);
set_terminal_mode
();
set_terminal_mode
();
err
=
shellReadCommand
(
con
,
command
);
err
=
shellReadCommand
(
con
,
command
);
if
(
err
)
{
if
(
err
)
{
...
...
src/kit/shell/src/shellMain.c
浏览文件 @
7259c0a6
...
@@ -95,6 +95,7 @@ SShellArguments args = {
...
@@ -95,6 +95,7 @@ SShellArguments args = {
*/
*/
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
/*setlocale(LC_ALL, "en_US.UTF-8"); */
/*setlocale(LC_ALL, "en_US.UTF-8"); */
printf
(
"hello wolrd shellmain.
\n
"
);
if
(
!
checkVersion
())
{
if
(
!
checkVersion
())
{
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
...
src/kit/shell/src/shellWindows.c
浏览文件 @
7259c0a6
...
@@ -301,13 +301,13 @@ int32_t shellReadCommand(TAOS *con, char command[]) {
...
@@ -301,13 +301,13 @@ int32_t shellReadCommand(TAOS *con, char command[]) {
void
*
shellLoopQuery
(
void
*
arg
)
{
void
*
shellLoopQuery
(
void
*
arg
)
{
TAOS
*
con
=
(
TAOS
*
)
arg
;
TAOS
*
con
=
(
TAOS
*
)
arg
;
char
*
command
=
malloc
(
MAX
_COMMAND_SIZE
);
char
*
command
=
malloc
(
DOUBLE
_COMMAND_SIZE
);
if
(
command
==
NULL
)
return
NULL
;
if
(
command
==
NULL
)
return
NULL
;
int32_t
err
=
0
;
int32_t
err
=
0
;
do
{
do
{
memset
(
command
,
0
,
MAX
_COMMAND_SIZE
);
memset
(
command
,
0
,
DOUBLE
_COMMAND_SIZE
);
shellPrintPrompt
();
shellPrintPrompt
();
// Read command from shell.
// Read command from shell.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录