feature(cloudcmd) --one-panel-mode -> --one-file-panel

This commit is contained in:
coderaiser 2018-04-10 11:45:52 +03:00
parent 0cb953af85
commit 7e14d61a34
11 changed files with 8 additions and 75 deletions

View file

@ -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

View file

@ -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",

View file

@ -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 = {

View file

@ -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 [

View file

@ -22,7 +22,6 @@
"confirmCopy": true,
"confirmMove": true,
"configDialog": true,
"onePanelMode": false,
"oneFilePanel": false,
"console": true,
"syncConsolePath": false,

View file

@ -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",

View file

@ -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

View file

@ -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);

View file

@ -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');

View file

@ -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 = '';

View file

@ -92,8 +92,8 @@
</li>
<li>
<label>
<input data-name="js-onePanelMode" type="checkbox" {{ onePanelMode }}>
One Panel Mode
<input data-name="js-oneFilePanel" type="checkbox" {{ oneFilePanel }}>
One File Panel
</label>
</li>
<li>