From e5e8a566e2401b698fa4749fe104ce73e3708b7d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 29 Sep 2017 11:46:15 +0300 Subject: [PATCH] feature(cloudcmd) add --confirm-move --- HELP.md | 4 ++++ app.json | 5 +++++ bin/cloudcmd.js | 3 +++ client/modules/operation/index.js | 13 +++++++------ json/config.json | 1 + json/help.json | 2 ++ man/cloudcmd.1 | 2 ++ tmpl/config.hbs | 6 ++++++ 8 files changed, 30 insertions(+), 6 deletions(-) diff --git a/HELP.md b/HELP.md index ca426c84..a632a66a 100644 --- a/HELP.md +++ b/HELP.md @@ -81,6 +81,7 @@ Cloud Commander supports command line parameters: | `--port` | set port number | `--progress` | show progress of file operations | `--confirm-copy` | confirm copy +| `--confirm-move` | confirm move | `--html-dialogs` | use html dialogs | `--open` | open web browser when server started | `--name` | set tab name in web browser @@ -99,6 +100,7 @@ Cloud Commander supports command line parameters: | `--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-confirm-move` | do not confirm move | `--no-html-dialogs` | do not use html dialogs | `--no-contact` | disable contact | `--no-config-dialog` | disable config dialog @@ -366,6 +368,7 @@ Here is description of options: "prefix" : "", /* url prefix */ "progress" : true, /* show progress of file operations */ "confirmCopy" : true, /* confirm copy */ + "confirmMove" : true, /* confirm move */ "htmlDialogs" : true, /* use html dialogs */ "onePanelMode" : false, /* set one panel mode */ "contact" : true, /* enable contact */ @@ -395,6 +398,7 @@ Some config options can be overridden with `environment variables` such: - `CLOUDCMD_ONE_PANEL_MODE` - set one panel mode - `CLOUDCMD_VIM` - enable vim hot keys - `CLOUDCMD_CONFIRM_COPY` - confirm copy +- `CLOUDCMD_CONFIRM_MOVE` - confirm move Menu --------------- diff --git a/app.json b/app.json index 2ee3916f..c8b209b9 100644 --- a/app.json +++ b/app.json @@ -86,6 +86,11 @@ "description": "confirm copy", "value": "true", "required": false + }, + "CLOUDCMD_CONFIRM_MOVE": { + "description": "confirm move", + "value": "true", + "required": false } } } diff --git a/bin/cloudcmd.js b/bin/cloudcmd.js index 937cb583..1e16399e 100755 --- a/bin/cloudcmd.js +++ b/bin/cloudcmd.js @@ -44,6 +44,7 @@ const args = require('minimist')(argv.slice(2), { 'terminal', 'one-panel-mode', 'confirm-copy', + 'confirm-move', 'html-dialogs', 'show-config', 'vim', @@ -70,6 +71,7 @@ const args = require('minimist')(argv.slice(2), { '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')), + 'confirm-move': choose(env.bool('confirm_move'), config('confirmMove')), 'html-dialogs': config('htmlDialogs'), 'vim': choose(env.bool('vim'), config('vim')), }, @@ -119,6 +121,7 @@ function main() { config('vim', args.vim); config('htmlDialogs', args['html-dialogs']); config('confirmCopy', args['confirm-copy']); + config('confirmMove', args['confirm-move']); config('onePanelMode', args['one-panel-mode']); config('configDialog', args['config-dialog']); diff --git a/client/modules/operation/index.js b/client/modules/operation/index.js index b11e5416..b3f107e0 100644 --- a/client/modules/operation/index.js +++ b/client/modules/operation/index.js @@ -438,12 +438,13 @@ function OperationProto(operation, data) { const {type} = options; - if (shouldAsk && config(type)) { - const isCopy = type === 'copy'; - const title = isCopy ? 'Copy' : 'Rename/Move'; - - return message(title, to, names).then(ask); - } + const isCopy = type === 'copy'; + const option = isCopy ? 'confirmCopy' : 'confirmMove'; + const title = isCopy ? 'Copy' : 'Rename/Move'; + + if (shouldAsk && config(option)) + return message(title, to, names) + .then(ask); ask(to); diff --git a/json/config.json b/json/config.json index 332fbd79..f8e93856 100644 --- a/json/config.json +++ b/json/config.json @@ -23,6 +23,7 @@ "htmlDialogs": true, "contact": true, "confirmCopy": true, + "confirmMove": true, "configDialog": true, "onePanelMode": false, "console": true, diff --git a/json/help.json b/json/help.json index e74075a7..56cd46fd 100644 --- a/json/help.json +++ b/json/help.json @@ -15,6 +15,7 @@ "--port ": "set port number", "--progress ": "show progress of file operations", "--confirm-copy ": "confirm copy", + "--confirm-move ": "confirm move", "--html-dialogs ": "use html dialogs", "--open ": "open web browser when server started", "--name ": "set tab name in web browser", @@ -33,6 +34,7 @@ "--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-confirm-move ": "do not confirm move", "--no-html-dialogs ": "do not use html dialogs", "--no-config-dialog ": "disable config dialog", "--no-console ": "disable console", diff --git a/man/cloudcmd.1 b/man/cloudcmd.1 index 286fcc70..3157d1e7 100644 --- a/man/cloudcmd.1 +++ b/man/cloudcmd.1 @@ -38,6 +38,7 @@ programs in browser from any computer, mobile or tablet device. --port set port number --progress show progress of file operations --confirm-copy confirm copy + --confirm-move confirm move --html-dialogs use html dialogs --open open web browser when server started --name set tab name in web browser @@ -56,6 +57,7 @@ programs in browser from any computer, mobile or tablet device. --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-confirm-move do not confirm move --no-html-dialogs do not use html dialogs --no-contact disable contact --no-config-dialog disable config dialog diff --git a/tmpl/config.hbs b/tmpl/config.hbs index cce7f912..b9ee86b1 100644 --- a/tmpl/config.hbs +++ b/tmpl/config.hbs @@ -134,6 +134,12 @@ Confirm Copy + +
  • +