cloudcmd 17.2.1 → 17.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +6 -0
- package/HELP.md +6 -5
- package/README.md +1 -1
- package/bin/cloudcmd.mjs +11 -4
- package/dist/cloudcmd.common.js +3 -3
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/cloudcmd.css +1 -1
- package/dist/cloudcmd.js +1 -1
- package/dist/cloudcmd.js.map +1 -1
- package/dist/index.html +1 -1
- package/dist/modules/cloud.js +1 -1
- package/dist/modules/cloud.js.map +1 -1
- package/dist/modules/command-line.js +1 -1
- package/dist/modules/command-line.js.map +1 -1
- package/dist/modules/config.js +1 -1
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/contact.js +1 -1
- package/dist/modules/contact.js.map +1 -1
- package/dist/modules/edit-file-vim.js +1 -1
- package/dist/modules/edit-file-vim.js.map +1 -1
- package/dist/modules/edit-file.js +1 -1
- package/dist/modules/edit-file.js.map +1 -1
- package/dist/modules/edit-names-vim.js +1 -1
- package/dist/modules/edit-names-vim.js.map +1 -1
- package/dist/modules/edit-names.js +1 -1
- package/dist/modules/edit-names.js.map +1 -1
- package/dist/modules/edit.js +1 -1
- package/dist/modules/edit.js.map +1 -1
- package/dist/modules/help.js +1 -1
- package/dist/modules/help.js.map +1 -1
- package/dist/modules/konsole.js +1 -1
- package/dist/modules/konsole.js.map +1 -1
- package/dist/modules/markdown.js +1 -1
- package/dist/modules/markdown.js.map +1 -1
- package/dist/modules/menu.js +1 -1
- package/dist/modules/menu.js.map +1 -1
- package/dist/modules/operation.js +1 -1
- package/dist/modules/operation.js.map +1 -1
- package/dist/modules/polyfill.js +1 -1
- package/dist/modules/polyfill.js.map +1 -1
- package/dist/modules/terminal-run.js +1 -1
- package/dist/modules/terminal-run.js.map +1 -1
- package/dist/modules/terminal.js +1 -1
- package/dist/modules/terminal.js.map +1 -1
- package/dist/modules/upload.js +1 -1
- package/dist/modules/upload.js.map +1 -1
- package/dist/modules/user-menu.js +1 -1
- package/dist/modules/user-menu.js.map +1 -1
- package/dist/modules/view.js +1 -1
- package/dist/modules/view.js.map +1 -1
- package/dist/sw.js +4 -2
- package/dist/themes/dark.css +1 -0
- package/dist/themes/light.css +1 -0
- package/dist-dev/cloudcmd.css +2 -10
- package/dist-dev/cloudcmd.js +35 -1
- package/dist-dev/index.html +3 -0
- package/dist-dev/modules/config.js +1 -1
- package/dist-dev/sw.js +4 -2
- package/dist-dev/themes/dark.css +49 -0
- package/dist-dev/themes/light.css +9 -0
- package/json/config.json +1 -0
- package/json/help.json +1 -0
- package/man/cloudcmd.1 +1 -0
- package/package.json +1 -1
- package/server/cloudcmd.mjs +3 -3
- package/server/{columns.js → columns.mjs} +13 -12
- package/server/columns.spec.mjs +40 -0
- package/server/{route.js → route.mjs} +24 -23
- package/server/route.spec.mjs +1 -1
- package/server/theme.mjs +33 -0
- package/server/themes.spec.mjs +31 -0
- package/server/{validate.js → validate.mjs} +24 -10
- package/server/validate.spec.mjs +30 -1
- package/tmpl/config.hbs +7 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import {statSync as _statSync} from 'node:fs';
|
|
2
|
+
import tryCatch from 'try-catch';
|
|
3
|
+
import _exit from './exit.js';
|
|
4
|
+
import {getColumns as _getColumns} from './columns.mjs';
|
|
5
|
+
import {getThemes as _getThemes} from './theme.mjs';
|
|
2
6
|
|
|
3
|
-
const {statSync: _statSync} = require('node:fs');
|
|
4
|
-
const tryCatch = require('try-catch');
|
|
5
|
-
|
|
6
|
-
const _exit = require('./exit');
|
|
7
|
-
const {getColumns: _getColumns} = require('./columns');
|
|
8
7
|
const isString = (a) => typeof a === 'string';
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
export const root = (dir, config, {exit = _exit, statSync = _statSync} = {}) => {
|
|
11
10
|
if (!isString(dir))
|
|
12
11
|
throw Error('dir should be a string');
|
|
13
12
|
|
|
@@ -23,21 +22,21 @@ module.exports.root = (dir, config, {exit = _exit, statSync = _statSync} = {}) =
|
|
|
23
22
|
return exit('cloudcmd --root: %s', error.message);
|
|
24
23
|
};
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
export const editor = (name, {exit = _exit} = {}) => {
|
|
27
26
|
const reg = /^(dword|edward|deepword)$/;
|
|
28
27
|
|
|
29
28
|
if (!reg.test(name))
|
|
30
29
|
exit('cloudcmd --editor: could be "dword", "edward" or "deepword" only');
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
export const packer = (name, {exit = _exit} = {}) => {
|
|
34
33
|
const reg = /^(tar|zip)$/;
|
|
35
34
|
|
|
36
35
|
if (!reg.test(name))
|
|
37
36
|
exit('cloudcmd --packer: could be "tar" or "zip" only');
|
|
38
37
|
};
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
export const columns = (type, {exit = _exit, getColumns = _getColumns} = {}) => {
|
|
41
40
|
const addQuotes = (a) => `"${a}"`;
|
|
42
41
|
const all = Object
|
|
43
42
|
.keys(getColumns())
|
|
@@ -51,3 +50,18 @@ module.exports.columns = (type, {exit = _exit, getColumns = _getColumns} = {}) =
|
|
|
51
50
|
if (!all.includes(type))
|
|
52
51
|
exit(`cloudcmd --columns: can be only one of: ${names}`);
|
|
53
52
|
};
|
|
53
|
+
|
|
54
|
+
export const theme = (type, {exit = _exit, getThemes = _getThemes} = {}) => {
|
|
55
|
+
const addQuotes = (a) => `"${a}"`;
|
|
56
|
+
const all = Object
|
|
57
|
+
.keys(getThemes())
|
|
58
|
+
.concat('');
|
|
59
|
+
|
|
60
|
+
const names = all
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.map(addQuotes)
|
|
63
|
+
.join(', ');
|
|
64
|
+
|
|
65
|
+
if (!all.includes(type))
|
|
66
|
+
exit(`cloudcmd --theme: can be only one of: ${names}`);
|
|
67
|
+
};
|
package/server/validate.spec.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {test, stub} from 'supertape';
|
|
2
2
|
import tryCatch from 'try-catch';
|
|
3
|
-
import validate from './validate.
|
|
3
|
+
import * as validate from './validate.mjs';
|
|
4
4
|
import cloudcmd from './cloudcmd.mjs';
|
|
5
5
|
|
|
6
6
|
test('validate: root: bad', (t) => {
|
|
@@ -102,3 +102,32 @@ test('validate: columns: wrong', (t) => {
|
|
|
102
102
|
t.calledWith(exit, [msg], 'should call exit');
|
|
103
103
|
t.end();
|
|
104
104
|
});
|
|
105
|
+
|
|
106
|
+
test('validate: theme', (t) => {
|
|
107
|
+
const exit = stub();
|
|
108
|
+
|
|
109
|
+
validate.theme('dark', {
|
|
110
|
+
exit,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
t.notCalled(exit, 'should not call exit');
|
|
114
|
+
t.end();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('validate: theme: wrong', (t) => {
|
|
118
|
+
const getThemes = stub().returns({
|
|
119
|
+
light: '',
|
|
120
|
+
dark: '',
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const exit = stub();
|
|
124
|
+
const msg = 'cloudcmd --theme: can be only one of: "light", "dark"';
|
|
125
|
+
|
|
126
|
+
validate.theme('hello', {
|
|
127
|
+
exit,
|
|
128
|
+
getThemes,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
t.calledWith(exit, [msg], 'should call exit');
|
|
132
|
+
t.end();
|
|
133
|
+
});
|
package/tmpl/config.hbs
CHANGED
|
@@ -43,8 +43,14 @@
|
|
|
43
43
|
Zip
|
|
44
44
|
</label>
|
|
45
45
|
</li>
|
|
46
|
+
<li title="Theme">
|
|
47
|
+
<select data-name="js-theme" class="form-control full-width" title="Theme">
|
|
48
|
+
<option {{ light-selected }}>light</option>
|
|
49
|
+
<option {{ dark-selected }}>dark</option>
|
|
50
|
+
</select>
|
|
51
|
+
</li>
|
|
46
52
|
<li title="Visible Columns">
|
|
47
|
-
<select data-name="js-
|
|
53
|
+
<select data-name="js-themes" class="form-control full-width" title="Visible Columns">
|
|
48
54
|
<option {{ name-size-date-owner-mode-selected }}>name-size-date-owner-mode</option>
|
|
49
55
|
<option {{ name-size-date-selected }}>name-size-date</option>
|
|
50
56
|
<option {{ name-size-selected }}>name-size</option>
|