mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) add --confirm-copy
This commit is contained in:
parent
df28ac7a78
commit
743b76d3ec
8 changed files with 66 additions and 38 deletions
4
HELP.md
4
HELP.md
|
|
@ -80,6 +80,7 @@ Cloud Commander supports command line parameters:
|
||||||
| `--prefix` | set url prefix
|
| `--prefix` | set url prefix
|
||||||
| `--port` | set port number
|
| `--port` | set port number
|
||||||
| `--progress` | show progress of file operations
|
| `--progress` | show progress of file operations
|
||||||
|
| `--confirm-copy` | confirm copy
|
||||||
| `--html-dialogs` | use html dialogs
|
| `--html-dialogs` | use html dialogs
|
||||||
| `--open` | open web browser when server started
|
| `--open` | open web browser when server started
|
||||||
| `--name` | set tab name in web browser
|
| `--name` | set tab name in web browser
|
||||||
|
|
@ -97,6 +98,7 @@ Cloud Commander supports command line parameters:
|
||||||
| `--no-name` | set empty tab name in web browser
|
| `--no-name` | set empty tab name in web browser
|
||||||
| `--no-one-panel-mode` | unset one panel mode
|
| `--no-one-panel-mode` | unset one panel mode
|
||||||
| `--no-progress` | do not show progress of file operations
|
| `--no-progress` | do not show progress of file operations
|
||||||
|
| `--no-confirm-copy` | do not confirm copy
|
||||||
| `--no-html-dialogs` | do not use html dialogs
|
| `--no-html-dialogs` | do not use html dialogs
|
||||||
| `--no-contact` | disable contact
|
| `--no-contact` | disable contact
|
||||||
| `--no-config-dialog` | disable config dialog
|
| `--no-config-dialog` | disable config dialog
|
||||||
|
|
@ -363,6 +365,7 @@ Here is description of options:
|
||||||
"root" : "/", /* root directory */
|
"root" : "/", /* root directory */
|
||||||
"prefix" : "", /* url prefix */
|
"prefix" : "", /* url prefix */
|
||||||
"progress" : true, /* show progress of file operations */
|
"progress" : true, /* show progress of file operations */
|
||||||
|
"confirmCopy" : true, /* confirm copy */
|
||||||
"htmlDialogs" : true, /* use html dialogs */
|
"htmlDialogs" : true, /* use html dialogs */
|
||||||
"onePanelMode" : false, /* set one panel mode */
|
"onePanelMode" : false, /* set one panel mode */
|
||||||
"contact" : true, /* enable contact */
|
"contact" : true, /* enable contact */
|
||||||
|
|
@ -391,6 +394,7 @@ Some config options can be overridden with `environment variables` such:
|
||||||
- `CLOUDCMD_ROOT` - set root directory
|
- `CLOUDCMD_ROOT` - set root directory
|
||||||
- `CLOUDCMD_ONE_PANEL_MODE` - set one panel mode
|
- `CLOUDCMD_ONE_PANEL_MODE` - set one panel mode
|
||||||
- `CLOUDCMD_VIM` - enable vim hot keys
|
- `CLOUDCMD_VIM` - enable vim hot keys
|
||||||
|
- `CLOUDCMD_CONFIRM_COPY` - confirm copy
|
||||||
|
|
||||||
Menu
|
Menu
|
||||||
---------------
|
---------------
|
||||||
|
|
|
||||||
5
app.json
5
app.json
|
|
@ -81,6 +81,11 @@
|
||||||
"description": "enable vim hot keys",
|
"description": "enable vim hot keys",
|
||||||
"value": "false",
|
"value": "false",
|
||||||
"required": false
|
"required": false
|
||||||
|
},
|
||||||
|
"CLOUDCMD_CONFIRM_COPY": {
|
||||||
|
"description": "confirm copy",
|
||||||
|
"value": "true",
|
||||||
|
"required": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ const args = require('minimist')(argv.slice(2), {
|
||||||
'contact',
|
'contact',
|
||||||
'terminal',
|
'terminal',
|
||||||
'one-panel-mode',
|
'one-panel-mode',
|
||||||
|
'confirm-copy',
|
||||||
'html-dialogs',
|
'html-dialogs',
|
||||||
'show-config',
|
'show-config',
|
||||||
'vim',
|
'vim',
|
||||||
|
|
@ -65,9 +66,10 @@ const args = require('minimist')(argv.slice(2), {
|
||||||
contact : choose(env.bool('contact'), config('contact')),
|
contact : choose(env.bool('contact'), config('contact')),
|
||||||
terminal : choose(env.bool('terminal'), config('terminal')),
|
terminal : choose(env.bool('terminal'), config('terminal')),
|
||||||
|
|
||||||
'terminal-path': env('terminal_path') || config('terminalPath'),
|
|
||||||
'config-dialog': choose(env.bool('config_dialog'), config('configDialog')),
|
'config-dialog': choose(env.bool('config_dialog'), config('configDialog')),
|
||||||
|
'terminal-path': env('terminal_path') || config('terminalPath'),
|
||||||
'one-panel-mode': choose(env.bool('one_panel_mode'), config('onePanelMode')),
|
'one-panel-mode': choose(env.bool('one_panel_mode'), config('onePanelMode')),
|
||||||
|
'confirm-copy': choose(env.bool('confirm_copy'), config('confirmCopy')),
|
||||||
'html-dialogs': config('htmlDialogs'),
|
'html-dialogs': config('htmlDialogs'),
|
||||||
'vim': choose(env.bool('vim'), config('vim')),
|
'vim': choose(env.bool('vim'), config('vim')),
|
||||||
},
|
},
|
||||||
|
|
@ -116,6 +118,7 @@ function main() {
|
||||||
config('root', args.root);
|
config('root', args.root);
|
||||||
config('vim', args.vim);
|
config('vim', args.vim);
|
||||||
config('htmlDialogs', args['html-dialogs']);
|
config('htmlDialogs', args['html-dialogs']);
|
||||||
|
config('confirmCopy', args['confirm-copy']);
|
||||||
config('onePanelMode', args['one-panel-mode']);
|
config('onePanelMode', args['one-panel-mode']);
|
||||||
config('configDialog', args['config-dialog']);
|
config('configDialog', args['config-dialog']);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ function OperationProto(operation, data) {
|
||||||
const Info = DOM.CurrentInfo;
|
const Info = DOM.CurrentInfo;
|
||||||
const showLoad = Images.show.load.bind(null, 'top');
|
const showLoad = Images.show.load.bind(null, 'top');
|
||||||
const Operation = this;
|
const Operation = this;
|
||||||
|
const processFiles = currify(_processFiles);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
showLoad();
|
showLoad();
|
||||||
|
|
@ -278,13 +279,13 @@ function OperationProto(operation, data) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.copy = (data) => {
|
this.copy = processFiles(copyFn, {
|
||||||
processFiles(data, copyFn, message('Copy'));
|
type: 'copy',
|
||||||
};
|
});
|
||||||
|
|
||||||
this.move = (data) => {
|
this.move = processFiles(moveFn, {
|
||||||
processFiles(data, moveFn, message('Rename/Move'));
|
type: 'move'
|
||||||
};
|
});
|
||||||
|
|
||||||
this.delete = () => {
|
this.delete = () => {
|
||||||
promptDelete();
|
promptDelete();
|
||||||
|
|
@ -398,17 +399,17 @@ function OperationProto(operation, data) {
|
||||||
* @param data
|
* @param data
|
||||||
* @param operation
|
* @param operation
|
||||||
*/
|
*/
|
||||||
function processFiles(data, operation, message) {
|
function _processFiles(operation, options, data) {
|
||||||
var name, selFiles, files,
|
let name, selFiles, files;
|
||||||
panel,
|
let panel;
|
||||||
shouldAsk,
|
let shouldAsk;
|
||||||
sameName,
|
let sameName;
|
||||||
ok,
|
let ok;
|
||||||
|
|
||||||
from = '',
|
let from = '';
|
||||||
to = '',
|
let to = '';
|
||||||
|
|
||||||
names = [];
|
let names = [];
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
from = data.from;
|
from = data.from;
|
||||||
|
|
@ -435,8 +436,14 @@ function OperationProto(operation, data) {
|
||||||
if (name === '..')
|
if (name === '..')
|
||||||
return Dialog.alert.noFiles(TITLE);
|
return Dialog.alert.noFiles(TITLE);
|
||||||
|
|
||||||
if (shouldAsk)
|
const {type} = options;
|
||||||
return message(to, names).then(ask);
|
|
||||||
|
if (shouldAsk && config(type)) {
|
||||||
|
const isCopy = type === 'copy';
|
||||||
|
const title = isCopy ? 'Copy' : 'Rename/Move';
|
||||||
|
|
||||||
|
return message(title, to, names).then(ask);
|
||||||
|
}
|
||||||
|
|
||||||
ask(to);
|
ask(to);
|
||||||
|
|
||||||
|
|
@ -543,24 +550,22 @@ function OperationProto(operation, data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function message(msg) {
|
function message(msg, to, names) {
|
||||||
return (to, names) => {
|
const n = names.length;
|
||||||
const n = names.length;
|
const name = names[0];
|
||||||
const name = names[0];
|
|
||||||
|
msg += ' ';
|
||||||
msg += ' ';
|
|
||||||
|
if (names.length > 1)
|
||||||
if (names.length > 1)
|
msg += n + ' file(s)';
|
||||||
msg += n + ' file(s)';
|
else
|
||||||
else
|
msg += '"' + name + '"';
|
||||||
msg += '"' + name + '"';
|
|
||||||
|
msg += ' to';
|
||||||
msg += ' to';
|
|
||||||
|
const cancel = false;
|
||||||
const cancel = false;
|
|
||||||
|
return Dialog.prompt(TITLE, msg, to, {cancel});
|
||||||
return Dialog.prompt(TITLE, msg, to, {cancel});
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function load(callback) {
|
function load(callback) {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
"progress": true,
|
"progress": true,
|
||||||
"htmlDialogs": true,
|
"htmlDialogs": true,
|
||||||
"contact": true,
|
"contact": true,
|
||||||
|
"confirmCopy": true,
|
||||||
"configDialog": true,
|
"configDialog": true,
|
||||||
"onePanelMode": false,
|
"onePanelMode": false,
|
||||||
"console": true,
|
"console": true,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
"--prefix ": "set url prefix",
|
"--prefix ": "set url prefix",
|
||||||
"--port ": "set port number",
|
"--port ": "set port number",
|
||||||
"--progress ": "show progress of file operations",
|
"--progress ": "show progress of file operations",
|
||||||
|
"--confirm-copy ": "confirm copy",
|
||||||
"--html-dialogs ": "use html dialogs",
|
"--html-dialogs ": "use html dialogs",
|
||||||
"--open ": "open web browser when server started",
|
"--open ": "open web browser when server started",
|
||||||
"--name ": "set tab name in web browser",
|
"--name ": "set tab name in web browser",
|
||||||
|
|
@ -31,6 +32,7 @@
|
||||||
"--no-name ": "set default tab name in web browser",
|
"--no-name ": "set default tab name in web browser",
|
||||||
"--no-one-panel-mode ": "unset one panel mode",
|
"--no-one-panel-mode ": "unset one panel mode",
|
||||||
"--no-progress ": "do not show progress of file operations",
|
"--no-progress ": "do not show progress of file operations",
|
||||||
|
"--no-confirm-copy ": "do not confirm copy",
|
||||||
"--no-html-dialogs ": "do not use html dialogs",
|
"--no-html-dialogs ": "do not use html dialogs",
|
||||||
"--no-config-dialog ": "disable config dialog",
|
"--no-config-dialog ": "disable config dialog",
|
||||||
"--no-console ": "disable console",
|
"--no-console ": "disable console",
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ programs in browser from any computer, mobile or tablet device.
|
||||||
--prefix set url prefix
|
--prefix set url prefix
|
||||||
--port set port number
|
--port set port number
|
||||||
--progress show progress of file operations
|
--progress show progress of file operations
|
||||||
|
--confirm-copy confirm copy
|
||||||
--html-dialogs use html dialogs
|
--html-dialogs use html dialogs
|
||||||
--open open web browser when server started
|
--open open web browser when server started
|
||||||
--name set tab name in web browser
|
--name set tab name in web browser
|
||||||
|
|
@ -54,6 +55,7 @@ programs in browser from any computer, mobile or tablet device.
|
||||||
--no-name set default tab name in web browser
|
--no-name set default tab name in web browser
|
||||||
--no-one-panel-mode unset one panel mode
|
--no-one-panel-mode unset one panel mode
|
||||||
--no-progress do not show progress of file operations
|
--no-progress do not show progress of file operations
|
||||||
|
--no-confirm-copy do not confirm copy
|
||||||
--no-html-dialogs do not use html dialogs
|
--no-html-dialogs do not use html dialogs
|
||||||
--no-contact disable contact
|
--no-contact disable contact
|
||||||
--no-config-dialog disable config dialog
|
--no-config-dialog disable config dialog
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,12 @@
|
||||||
value="{{ port }}"
|
value="{{ port }}"
|
||||||
placeholder="Port"
|
placeholder="Port"
|
||||||
class="form-control">
|
class="form-control">
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label>
|
||||||
|
<input data-name="js-confirmCopy" type="checkbox" {{ confirmCopy }}>
|
||||||
|
Confirm Copy
|
||||||
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue