mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-22 18:29:26 +00:00
feature: client: add Command Line
This commit is contained in:
parent
a5229fae06
commit
24fbeec62d
7 changed files with 48 additions and 2 deletions
|
|
@ -93,6 +93,7 @@ module.exports = {
|
|||
[modules + '/cloud']: `${dirModules}/cloud.js`,
|
||||
[modules + '/user-menu']: `${dirModules}/user-menu/index.js`,
|
||||
[modules + '/polyfill']: `${dirModules}/polyfill.js`,
|
||||
[modules + '/command-line']: `${dirModules}/command-line.js`,
|
||||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
|
|
|
|||
1
HELP.md
1
HELP.md
|
|
@ -172,6 +172,7 @@ Then, start the server again with `cloudcmd` and reload the page.
|
|||
| `*` | select/unselect all
|
||||
| `+` | expand selection
|
||||
| `-` | shrink selection
|
||||
| `:` | open Command Line
|
||||
| `Ctrl + X` | cut to buffer
|
||||
| `Ctrl + C` | copy to buffer
|
||||
| `Ctrl + V` | paste from buffer
|
||||
|
|
|
|||
|
|
@ -499,6 +499,11 @@ async function switchKey(event) {
|
|||
|
||||
break;
|
||||
|
||||
case KEY.COLON:
|
||||
CloudCmd.CommandLine.show();
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
||||
/* чистим хранилище */
|
||||
case KEY.D:
|
||||
if (ctrlMeta) {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ module.exports = {
|
|||
|
||||
SEMICOLON : 52,
|
||||
|
||||
COLON : 54,
|
||||
|
||||
A : 65,
|
||||
|
||||
C : 67,
|
||||
|
|
@ -70,6 +68,7 @@ module.exports = {
|
|||
F9 : 120,
|
||||
F10 : 121,
|
||||
|
||||
COLON : 186,
|
||||
EQUAL : 187,
|
||||
HYPHEN : 189,
|
||||
DOT : 190,
|
||||
|
|
|
|||
38
client/modules/command-line.js
Normal file
38
client/modules/command-line.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
'use strict';
|
||||
|
||||
/* global CloudCmd */
|
||||
|
||||
CloudCmd.CommandLine = exports;
|
||||
|
||||
const Images = require('../dom/images');
|
||||
const Dialog = require('../dom/dialog');
|
||||
|
||||
module.exports.init = () => {};
|
||||
|
||||
module.exports.show = show;
|
||||
module.exports.hide = hide;
|
||||
|
||||
async function show() {
|
||||
const [, cmd] = await Dialog.prompt('Command Line', '');
|
||||
const TERMINAL = '^(t|terminal)';
|
||||
|
||||
if (RegExp(`${TERMINAL}$`).test(cmd)) {
|
||||
return await CloudCmd.Terminal.show();
|
||||
}
|
||||
|
||||
if (RegExp(TERMINAL).test(cmd)) {
|
||||
const command = cmd.replace(RegExp(`${TERMINAL} `), '');
|
||||
const exitCode = await CloudCmd.TerminalRun.show({
|
||||
command: `bash -c '${command}'`,
|
||||
});
|
||||
|
||||
if (exitCode === -1)
|
||||
await Dialog.alert(`☝️ Looks like Terminal is disabled, start Cloud Coammnder with '--terminal' flag.`);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function hide() {
|
||||
}
|
||||
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
"markdown",
|
||||
"config",
|
||||
"contact",
|
||||
"command-line",
|
||||
"upload",
|
||||
"operation",
|
||||
"konsole",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
"name": "cloudcmd",
|
||||
"version": "16.4.1",
|
||||
"type": "commonjs",
|
||||
"commitType": "colon",
|
||||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
||||
"description": "File manager for the web with console and editor",
|
||||
"homepage": "http://cloudcmd.io",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue