Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
86ba9eec
Commit
86ba9eec
authored
Jan 20, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Enhance:Module:Terminal) add new local command ashelp & ascmd
parent
f98c1fd5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
4 deletions
+44
-4
CHANGELOG.md
CHANGELOG.md
+10
-0
en.js
source/language/en.js
+5
-1
zh.js
source/language/zh.js
+5
-1
index.js
source/modules/terminal/index.js
+24
-2
No files found.
CHANGELOG.md
View file @
86ba9eec
...
...
@@ -14,6 +14,16 @@
*
新增「复制文件名」和「复制文件路径」功能,目标复制文件名或路径到剪贴板
*
编辑文件菜单可选择「标签打开」和「窗口打开」
### 虚拟终端
*
新增两条本地命令
*
ashelp 列出所有本地命令
*
ascmd 指定某个文件执行后续的命令. eg: ascmd /bin/bash 这样后续输入的命令将会使用 /bin/bash 来执行。注意仅对当前有效, 如果需要持久生效, 需要在shell配置中的「其它配置」设置。
### 系统设置
*
新增「默认设置」, 可在此配置文件管理默认编辑文件打开方式
### Other
*
新增 Python2 Custom CGI shell 示例
...
...
source/language/en.js
View file @
86ba9eec
...
...
@@ -185,7 +185,11 @@ module.exports = {
system
:
'System Info'
,
user
:
'Current User'
,
path
:
'Current Path'
}
},
ascmd
:
{
ashelp
:
`Usage:\nascmd file\t\tExecute the command with file, eg: ascmd /bin/bash\n`
,
ascmd
:
(
cmd
)
=>
antSword
.
noxss
(
`Will execute the command with
${
cmd
}
.`
),
},
},
filemanager
:
{
title
:
'FileManager'
,
...
...
source/language/zh.js
View file @
86ba9eec
...
...
@@ -186,7 +186,11 @@ module.exports = {
system
:
'系统信息'
,
user
:
'当前用户'
,
path
:
'当前路径'
}
},
ascmd
:
{
ashelp
:
`使用帮助:\nascmd file\t\t指定file来执行命令,eg: ascmd /bin/bash\n`
,
ascmd
:
(
cmd
)
=>
antSword
.
noxss
(
`将使用
${
cmd
}
执行命令.`
),
},
},
filemanager
:
{
title
:
'文件管理'
,
...
...
source/modules/terminal/index.js
View file @
86ba9eec
...
...
@@ -39,6 +39,7 @@ class Terminal {
this
.
term
=
null
;
this
.
cell
=
cell
;
this
.
isWin
=
true
;
this
.
sessbin
=
null
;
this
.
core
=
new
antSword
[
'core'
][
opts
[
'type'
]](
opts
);
this
.
cache
=
new
antSword
[
'CacheManager'
](
this
.
opts
[
'_id'
]);
...
...
@@ -95,6 +96,7 @@ class Terminal {
* @return {None} [description]
*/
initTerminal
(
ret
,
dom
)
{
let
self
=
this
;
let
info
=
ret
.
split
(
'
\
t'
);
let
infoUser
,
infoPath
,
infoDrive
,
infoSystem
;
let
banner
=
`[[b;cyan;](*)
${
LANG
[
'banner'
][
'title'
]}
]`
;
...
...
@@ -136,6 +138,21 @@ class Terminal {
if
(
cmd
===
'exit'
||
cmd
===
'quit'
)
{
return
this
.
cell
.
close
()
}
// clear清空
if
(
cmd
===
'cls'
||
cmd
===
'clear'
)
{
return
term
.
clear
()
}
if
(
cmd
===
'ashelp'
){
term
.
echo
(
LANG
[
'ascmd'
][
'ashelp'
]);
return
;
}
if
(
cmd
.
substr
(
0
,
5
)
===
'ascmd'
)
{
var
sessbin
=
cmd
.
substr
(
5
).
trim
();
if
(
sessbin
.
length
>
0
){
self
.
sessbin
=
sessbin
;
term
.
echo
(
LANG
[
'ascmd'
][
'ascmd'
](
self
.
sessbin
));
}
else
{
term
.
echo
(
LANG
[
'ascmd'
][
'ashelp'
]);
}
return
;
}
term
.
pause
();
// 是否有缓存
let
cacheTag
=
'command-'
+
new
Buffer
(
this
.
path
+
cmd
).
toString
(
'base64'
);
...
...
@@ -152,6 +169,9 @@ class Terminal {
let
_bin
=
this
.
isWin
?
'cmd'
:
'/bin/sh'
;
let
_confBin
=
(
this
.
opts
[
'otherConf'
]
||
{})[
'command-path'
];
_bin
=
_confBin
||
_bin
;
if
(
self
.
sessbin
!==
null
)
{
_bin
=
self
.
sessbin
;
}
// 开始执行命令
this
.
core
.
request
(
this
.
core
.
command
.
exec
({
...
...
@@ -202,7 +222,9 @@ class Terminal {
exit
:
false
,
// < 1.0.0 时使用3个参数 completion: (term, value, callback) => {}
completion
:
(
value
,
callback
)
=>
{
callback
(
callback
([
'ashelp'
,
'ascmd'
,
'quit'
,
'exit'
].
concat
(
this
.
isWin
?
[
'dir'
,
'whoami'
,
'net'
,
'ipconfig'
,
'netstat'
,
'cls'
,
'wscript'
,
'nslookup'
,
'copy'
,
'del'
,
'ren'
,
'md'
,
'type'
,
...
...
@@ -213,7 +235,7 @@ class Terminal {
'whoami'
,
'ifconfig'
,
'clear'
,
'ping'
]
)
)
)
},
keydown
:
(
event
,
terminal
)
=>
{
if
(
event
.
ctrlKey
==
true
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment