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