From 7e14d61a34016ecdc8e7d71dff37c353929ffb0e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 10 Apr 2018 11:45:52 +0300 Subject: [PATCH] feature(cloudcmd) --one-panel-mode -> --one-file-panel --- HELP.md | 4 ---- app.json | 5 ----- bin/cloudcmd.js | 24 +----------------------- client/client.js | 4 ++-- json/config.json | 1 - json/help.json | 1 - man/cloudcmd.1 | 3 +-- server/cloudcmd.js | 10 +--------- server/route.js | 2 +- test/server/cloudcmd.js | 25 ------------------------- tmpl/config.hbs | 4 ++-- 11 files changed, 8 insertions(+), 75 deletions(-) diff --git a/HELP.md b/HELP.md index 02a00269..0a68e3a4 100644 --- a/HELP.md +++ b/HELP.md @@ -84,7 +84,6 @@ Cloud Commander supports command line parameters: | `--confirm-move` | confirm move | `--open` | open web browser when server started | `--name` | set tab name in web browser -| `--one-panel-mode` | show one file panel (**deprecated**: use `--one-file-panel` instead) | `--one-file-panel` | show one file panel | `--keys-panel` | show keys panel | `--contact` | enable contact @@ -101,7 +100,6 @@ Cloud Commander supports command line parameters: | `--no-open` | do not open web browser when server started | `--no-name` | set empty tab name in web browser | `--no-one-file-panel` | show two file panels -| `--no-one-panel-mode` | show two file panels (**deprecated**: use `--no-one-file-panel` instead) | `--no-keys-panel` | hide keys panel | `--no-progress` | do not show progress of file operations | `--no-confirm-copy` | do not confirm copy @@ -365,7 +363,6 @@ Here is description of options: "dirStorage" : true, /* store directory listing */ "online" : true, /* load js files from cdn or local path */ "open" : false /* open web browser when server started */ - "onePanelMode" : false, /* show one file panel (deprecated) */ "oneFilePanel" : false, /* show one file panel */ "keysPanel" : true, /* show classic panel with buttons of keys */ "port" : 8000, /* http port */ @@ -401,7 +398,6 @@ Some config options can be overridden with `environment variables` such: - `CLOUDCMD_TERMINAL` - enable terminal - `CLOUDCMD_TERMINAL_PATH` - set terminal path - `CLOUDCMD_KEYS_PANEL` - show keys panel -- `CLOUDCMD_ONE_PANEL_MODE` - show one file panel (**deprecated**: use `CLOUDCMD_ONE_FILE_PANEL` instead) - `CLOUDCMD_ONE_FILE_PANEL` - show one file panel - `CLOUDCMD_AUTH` - enable authentication - `CLOUDCMD_USERNAME` - set username diff --git a/app.json b/app.json index 20d51ad8..676b54ee 100644 --- a/app.json +++ b/app.json @@ -92,11 +92,6 @@ "value": "", "required": false }, - "CLOUDCMD_ONE_PANEL_MODE": { - "description": "set one panel mode (deprecated use CLOUDCMD_ONE_FILE_PANEL)", - "value": "false", - "required": false - }, "CLOUDCMD_ONE_FILE_PANEL": { "description": "set one panel mode", "value": "false", diff --git a/bin/cloudcmd.js b/bin/cloudcmd.js index d2d4d40b..638ff452 100755 --- a/bin/cloudcmd.js +++ b/bin/cloudcmd.js @@ -2,9 +2,6 @@ 'use strict'; -const util = require('util'); -const noop = () => {}; - const Info = require('../package'); const DIR_SERVER = '../server/'; @@ -48,7 +45,6 @@ const args = require('minimist')(argv.slice(2), { 'contact', 'terminal', 'one-file-panel', - 'one-panel-mode', 'confirm-copy', 'confirm-move', 'show-config', @@ -76,8 +72,7 @@ const args = require('minimist')(argv.slice(2), { 'sync-console-path': choose(env.bool('sync_console_path'), config('syncConsolePath')), 'config-dialog': choose(env.bool('config_dialog'), config('configDialog')), 'terminal-path': env('terminal_path') || config('terminalPath'), - 'one-file-panel': choose(env.bool('one_file_panel'), config('onePanelMode')), - 'one-panel-mode': '', + 'one-file-panel': choose(env.bool('one_file_panel'), config('oneFilePanel')), 'confirm-copy': choose(env.bool('confirm_copy'), config('confirmCopy')), 'confirm-move': choose(env.bool('confirm_move'), config('confirmMove')), 'vim': choose(env.bool('vim'), config('vim')), @@ -132,27 +127,10 @@ function main() { config('columns', args.columns); config('confirmCopy', args['confirm-copy']); config('confirmMove', args['confirm-move']); - config('onePanelMode', args['one-file-panel']); config('oneFilePanel', args['one-file-panel']); config('configDialog', args['config-dialog']); config('keysPanel', args['keys-panel']); - if (args['one-panel-mode']) { - util.deprecate(noop, `cloudcmd --one-panel-mode: deprecated, use --one-file-panel instead`, 'DP0001')(); - config('oneFilePanel', true); - config('onePanelMode', true); - } else if (typeof args['one-panel-mode'] === 'boolean') { - util.deprecate(noop, `cloudcmd --no-one-panel-mode: deprecated, use --no-one-file-panel instead`, 'DP0001')(); - config('oneFilePanel', false); - config('onePanelMode', false); - } - - if (env('one_panel_mode')) { - util.deprecate(noop, `CLOUDCMD_ONE_PANEL_MODE deprecated, use CLOUDCMD_ONE_FILE_PANEL instead`, 'DP0001')(); - config('oneFilePanel', env.bool('one_panel_mode')); - config('onePanelMode', env.bool('one_panel_mode')); - } - readConfig(args.config); const options = { diff --git a/client/client.js b/client/client.js index 3cadee93..f0ef8ed9 100644 --- a/client/client.js +++ b/client/client.js @@ -225,7 +225,7 @@ function CloudCmdProto(Util, DOM) { config[key] = value; }; - if (config.onePanelMode) + if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity; exec.if(document.body.scrollIntoViewIfNeeded, func, funcBefore); @@ -372,7 +372,7 @@ function CloudCmdProto(Util, DOM) { function getPanels() { const panels = ['left']; - if (CloudCmd.config('onePanelMode')) + if (CloudCmd.config('oneFilePanel')) return panels; return [ diff --git a/json/config.json b/json/config.json index d610e960..ddbb477b 100644 --- a/json/config.json +++ b/json/config.json @@ -22,7 +22,6 @@ "confirmCopy": true, "confirmMove": true, "configDialog": true, - "onePanelMode": false, "oneFilePanel": false, "console": true, "syncConsolePath": false, diff --git a/json/help.json b/json/help.json index 81a481eb..fdc454fe 100644 --- a/json/help.json +++ b/json/help.json @@ -19,7 +19,6 @@ "--html-dialogs ": "use html dialogs", "--open ": "open web browser when server started", "--name ": "set tab name in web browser", - "--one-panel-mode ": "show one file panel (deprecated use --one-file-panel instead)", "--one-file-panel ": "show one file panel", "--keys-panel ": "show keys panel", "--config-dialog ": "enable config dialog", diff --git a/man/cloudcmd.1 b/man/cloudcmd.1 index 87d2a8f2..c3c027f6 100644 --- a/man/cloudcmd.1 +++ b/man/cloudcmd.1 @@ -41,8 +41,7 @@ programs in browser from any computer, mobile or tablet device. --confirm-move confirm move --open open web browser when server started --name set tab name in web browser - --one-panele-mode show one file panel (deprecated use --one-file-panel instead) - --one-file-panele show one file panel + --one-file-panel show one file panel --keys-panel show keys panel --contact enable contact --config-dialog enable config dialog diff --git a/server/cloudcmd.js b/server/cloudcmd.js index ba20da54..8777ee84 100644 --- a/server/cloudcmd.js +++ b/server/cloudcmd.js @@ -47,10 +47,6 @@ const notEmpty = (a) => a; const clean = (a) => a.filter(notEmpty); const noop = () => {}; -const deprecateOnePanelMode = (value) => { - util.deprecate(noop, 'onePanelMode is deprecated, use oneFilePanel instead', 'DP0001')(); - config('oneFilePanel', value); -}; module.exports = (params) => { const p = params || {}; @@ -65,11 +61,7 @@ module.exports = (params) => { keys.forEach((name) => { const value = options[name]; - if (name === 'onePanelMode') - deprecateOnePanelMode(); - else if (name === 'oneFilePanel') - config('onePanelMode', value); - else if (/root|editor|packer|columns/.test(name)) + if (/root|editor|packer|columns/.test(name)) validate[name](value); config(name, value); diff --git a/server/route.js b/server/route.js index 8ecda5db..fbf929d7 100644 --- a/server/route.js +++ b/server/route.js @@ -82,7 +82,7 @@ module.exports = currify((options, request, response, callback) => { * additional processing of index file */ function indexProcessing(options) { - const oneFilePanel = config('onePanelMode'); + const oneFilePanel = config('oneFilePanel'); const noContact = !config('contact'); const noConfig = !config('configDialog'); const noConsole = !config('console'); diff --git a/test/server/cloudcmd.js b/test/server/cloudcmd.js index 79c83ef3..c321c94d 100644 --- a/test/server/cloudcmd.js +++ b/test/server/cloudcmd.js @@ -222,31 +222,6 @@ test('cloudcmd: getIndexPath: development', (t) => { t.end(); }); -test('cloudcmd: deprecated: one panel mode', (t) => { - const config = { - onePanelMode: true - }; - - const { - deprecate: originalDeprecate - } = util; - - const deprecate = sinon - .stub() - .returns(noop); - - util.deprecate = deprecate; - - cloudcmd({ - config - }); - - util.deprecate = originalDeprecate; - - t.ok(deprecate.called, 'should call deprecate'); - t.end(); -}); - function cleanNodeEnv() { const {NODE_ENV} = process.env; process.env.NODE_ENV = ''; diff --git a/tmpl/config.hbs b/tmpl/config.hbs index 204e7607..0bd19c30 100644 --- a/tmpl/config.hbs +++ b/tmpl/config.hbs @@ -92,8 +92,8 @@