feature(cloudcmd) add --terminal-auto-restart

This commit is contained in:
coderaiser 2018-09-28 11:19:54 +03:00
parent 91ab03c0ed
commit 3ef7ba9fdf
5 changed files with 51 additions and 40 deletions

84
HELP.md
View file

@ -96,6 +96,7 @@ Cloud Commander supports command line parameters:
| `--terminal` | enable terminal | `--terminal` | enable terminal
| `--terminal-path` | set terminal path | `--terminal-path` | set terminal path
| `--terminal-command` | set command to run in terminal (shell by default) | `--terminal-command` | set command to run in terminal (shell by default)
| `--terminal-auto-restart` | restart command on exit
| `--vim` | enable vim hot keys | `--vim` | enable vim hot keys
| `--columns` | set visible columns | `--columns` | set visible columns
| `--export` | enable export of config through a server | `--export` | enable export of config through a server
@ -122,6 +123,7 @@ Cloud Commander supports command line parameters:
| `--no-contact` | disable contact | `--no-contact` | disable contact
| `--no-terminal` | disable terminal | `--no-terminal` | disable terminal
| `--no-terminal-command` | set default shell to run in terminal | `--no-terminal-command` | set default shell to run in terminal
| `--no-terminal-auto-restart` | do not restart command on exit
| `--no-vim` | disable vim hot keys | `--no-vim` | disable vim hot keys
| `--no-columns` | set default visible columns | `--no-columns` | set default visible columns
| `--no-export` | disable export config through a server | `--no-export` | disable export config through a server
@ -369,46 +371,47 @@ Here is description of options:
```js ```js
{ {
"name" : "", /* set tab name in web browser */ "name" : "", /* set tab name in web browser */
"auth" : false, /* enable http authentication */ "auth" : false, /* enable http authentication */
"username" : "root", /* username for authentication */ "username" : "root", /* username for authentication */
   "password"         : "toor",   /* password hash for authentication */    "password"         : "toor",   /* password hash for authentication */
"algo" : "sha512WithRSAEncryption", /* cryptographic algorithm */ "algo" : "sha512WithRSAEncryption", /* cryptographic algorithm */
"editor" : "edward", /* default, could be "dword" or "edward" */ "editor" : "edward", /* default, could be "dword" or "edward" */
"packer" : "tar", /* default, could be "tar" or "zip" */ "packer" : "tar", /* default, could be "tar" or "zip" */
"diff" : true, /* when save - send patch, not whole file */ "diff" : true, /* when save - send patch, not whole file */
"zip" : true, /* zip text before send / unzip before save */ "zip" : true, /* zip text before send / unzip before save */
"buffer" : true, /* buffer for copying files */ "buffer" : true, /* buffer for copying files */
"dirStorage" : true, /* store directory listing */ "dirStorage" : true, /* store directory listing */
"online" : false, /* do not load js files from cdn */ "online" : false, /* do not load js files from cdn */
"open" : true, /* open web browser when server started */ "open" : true, /* open web browser when server started */
"oneFilePanel" : false, /* show one file panel */ "oneFilePanel" : false, /* show one file panel */
"keysPanel" : true, /* show classic panel with buttons of keys */ "keysPanel" : true, /* show classic panel with buttons of keys */
"port" : 8000, /* http port */ "port" : 8000, /* http port */
"ip" : null, /* ip or null(default) */ "ip" : null, /* ip or null(default) */
"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 */ "confirmCopy" : true, /* confirm copy */
"confirmMove" : true, /* confirm move */ "confirmMove" : true, /* confirm move */
"showConfig" : false, /* show config at startap */ "showConfig" : false, /* show config at startap */
"showFileName" : false /* do not show file name in view and edit */ "showFileName" : false /* do not show file name in view and edit */
"contact" : true, /* enable contact */ "contact" : true, /* enable contact */
"configDialog" : true, /* enable config dialog */ "configDialog" : true, /* enable config dialog */
"console" : true, /* enable console */ "console" : true, /* enable console */
"syncConsolePath" : false /* do not sync console path */ "syncConsolePath" : false /* do not sync console path */
"terminal" : false, /* disable terminal */ "terminal" : false, /* disable terminal */
"terminalPath" : '', /* path of a terminal */ "terminalPath" : '', /* path of a terminal */
"terminalCommand" : '', /* set command to run in terminal */ "terminalCommand" : '', /* set command to run in terminal */
"vim" : false, /* disable vim hot keys */ "terminalAutoRestart" : true, /* restart command on exit */
"columns" : "name-size-date-owner-mode", /* set visible columns */ "vim" : false, /* disable vim hot keys */
"export" : false, /* enable export of config through a server */ "columns" : "name-size-date-owner-mode", /* set visible columns */
"exportToken" : "root", /* token used by export server */ "export" : false, /* enable export of config through a server */
"import" : false, /* enable import of config */ "exportToken" : "root", /* token used by export server */
"import-url" : "http://localhost:8000", /* url of an export server */ "import" : false, /* enable import of config */
"importToken" : "root", /* token used to connect to export server */ "import-url" : "http://localhost:8000", /* url of an export server */
"importListen" : false, /* listen on config updates */ "importToken" : "root", /* token used to connect to export server */
"log" : true /* logging */ "importListen" : false, /* listen on config updates */
"log" : true /* logging */
} }
``` ```
@ -426,6 +429,7 @@ Some config options can be overridden with `environment variables` such:
- `CLOUDCMD_TERMINAL` - enable terminal - `CLOUDCMD_TERMINAL` - enable terminal
- `CLOUDCMD_TERMINAL_PATH` - set terminal path - `CLOUDCMD_TERMINAL_PATH` - set terminal path
- `CLOUDCMD_TERMINAL_COMMAND` - set command to run in terminal (shell by default) - `CLOUDCMD_TERMINAL_COMMAND` - set command to run in terminal (shell by default)
- `CLOUDCMD_TERMINAL_AUTO_RESTART` - restart command on exit
- `CLOUDCMD_KEYS_PANEL` - show keys panel - `CLOUDCMD_KEYS_PANEL` - show keys panel
- `CLOUDCMD_ONE_FILE_PANEL` - show one file panel - `CLOUDCMD_ONE_FILE_PANEL` - show one file panel
- `CLOUDCMD_AUTH` - enable authentication - `CLOUDCMD_AUTH` - enable authentication

View file

@ -53,6 +53,7 @@ const args = require('minimist')(argv.slice(2), {
'sync-console-path', 'sync-console-path',
'contact', 'contact',
'terminal', 'terminal',
'terminal-auto-restart',
'one-file-panel', 'one-file-panel',
'confirm-copy', 'confirm-copy',
'confirm-move', 'confirm-move',
@ -97,6 +98,7 @@ const args = require('minimist')(argv.slice(2), {
'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'), 'terminal-path': env('terminal_path') || config('terminalPath'),
'terminal-command': env('terminal_command') || config('terminalCommand'), 'terminal-command': env('terminal_command') || config('terminalCommand'),
'terminal-auto-restart': choose(env.bool('terminal_auto_restart'), config('terminalAutoRestart')),
'one-file-panel': choose(env.bool('one_file_panel'), config('oneFilePanel')), 'one-file-panel': choose(env.bool('one_file_panel'), config('oneFilePanel')),
'confirm-copy': choose(env.bool('confirm_copy'), config('confirmCopy')), 'confirm-copy': choose(env.bool('confirm_copy'), config('confirmCopy')),
'confirm-move': choose(env.bool('confirm_move'), config('confirmMove')), 'confirm-move': choose(env.bool('confirm_move'), config('confirmMove')),
@ -146,6 +148,7 @@ function main() {
config('terminal', args.terminal); config('terminal', args.terminal);
config('terminalPath', args['terminal-path']); config('terminalPath', args['terminal-path']);
config('terminalCommand', args['terminal-command']); config('terminalCommand', args['terminal-command']);
config('terminalAutoRestart', args['terminal-auto-restart']);
config('editor', args.editor); config('editor', args.editor);
config('prefix', args.prefix); config('prefix', args.prefix);
config('root', args.root); config('root', args.root);

View file

@ -28,6 +28,7 @@
"terminal": false, "terminal": false,
"terminalPath": "", "terminalPath": "",
"terminalCommand": "", "terminalCommand": "",
"terminalAutoRestart": true,
"showConfig": false, "showConfig": false,
"showFileName": false, "showFileName": false,
"vim": false, "vim": false,

View file

@ -51,6 +51,7 @@ programs in browser from any computer, mobile or tablet device.
--terminal enable terminal --terminal enable terminal
--terminal-path set terminal path --terminal-path set terminal path
--terminal-command set command to run in terminal (shell by default) --terminal-command set command to run in terminal (shell by default)
--terminal-auto-restart restart command on exit
--vim enable vim hot keys --vim enable vim hot keys
--columns set visible columns --columns set visible columns
--export enable export of config through a server --export enable export of config through a server
@ -77,6 +78,7 @@ programs in browser from any computer, mobile or tablet device.
--no-sync-console-path do not sync console path --no-sync-console-path do not sync console path
--no-terminal disable terminal --no-terminal disable terminal
--no-terminal-command set default shell to run in terminal --no-terminal-command set default shell to run in terminal
--no-terminal-auto-restart do not restart command on exit
--no-vim disable vim hot keys --no-vim disable vim hot keys
--no-columns set visible default columns --no-columns set visible default columns
--no-export disable export of config through a server --no-export disable export of config through a server

View file

@ -150,6 +150,7 @@ function listen(prefix, socket) {
auth, auth,
prefix: prefix + '/gritty', prefix: prefix + '/gritty',
command: config('terminalCommand'), command: config('terminalCommand'),
autoRestart: config('terminalAutoRestart'),
}); });
distribute.export(socket); distribute.export(socket);