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.
Files changed (74) hide show
  1. package/ChangeLog +6 -0
  2. package/HELP.md +6 -5
  3. package/README.md +1 -1
  4. package/bin/cloudcmd.mjs +11 -4
  5. package/dist/cloudcmd.common.js +3 -3
  6. package/dist/cloudcmd.common.js.map +1 -1
  7. package/dist/cloudcmd.css +1 -1
  8. package/dist/cloudcmd.js +1 -1
  9. package/dist/cloudcmd.js.map +1 -1
  10. package/dist/index.html +1 -1
  11. package/dist/modules/cloud.js +1 -1
  12. package/dist/modules/cloud.js.map +1 -1
  13. package/dist/modules/command-line.js +1 -1
  14. package/dist/modules/command-line.js.map +1 -1
  15. package/dist/modules/config.js +1 -1
  16. package/dist/modules/config.js.map +1 -1
  17. package/dist/modules/contact.js +1 -1
  18. package/dist/modules/contact.js.map +1 -1
  19. package/dist/modules/edit-file-vim.js +1 -1
  20. package/dist/modules/edit-file-vim.js.map +1 -1
  21. package/dist/modules/edit-file.js +1 -1
  22. package/dist/modules/edit-file.js.map +1 -1
  23. package/dist/modules/edit-names-vim.js +1 -1
  24. package/dist/modules/edit-names-vim.js.map +1 -1
  25. package/dist/modules/edit-names.js +1 -1
  26. package/dist/modules/edit-names.js.map +1 -1
  27. package/dist/modules/edit.js +1 -1
  28. package/dist/modules/edit.js.map +1 -1
  29. package/dist/modules/help.js +1 -1
  30. package/dist/modules/help.js.map +1 -1
  31. package/dist/modules/konsole.js +1 -1
  32. package/dist/modules/konsole.js.map +1 -1
  33. package/dist/modules/markdown.js +1 -1
  34. package/dist/modules/markdown.js.map +1 -1
  35. package/dist/modules/menu.js +1 -1
  36. package/dist/modules/menu.js.map +1 -1
  37. package/dist/modules/operation.js +1 -1
  38. package/dist/modules/operation.js.map +1 -1
  39. package/dist/modules/polyfill.js +1 -1
  40. package/dist/modules/polyfill.js.map +1 -1
  41. package/dist/modules/terminal-run.js +1 -1
  42. package/dist/modules/terminal-run.js.map +1 -1
  43. package/dist/modules/terminal.js +1 -1
  44. package/dist/modules/terminal.js.map +1 -1
  45. package/dist/modules/upload.js +1 -1
  46. package/dist/modules/upload.js.map +1 -1
  47. package/dist/modules/user-menu.js +1 -1
  48. package/dist/modules/user-menu.js.map +1 -1
  49. package/dist/modules/view.js +1 -1
  50. package/dist/modules/view.js.map +1 -1
  51. package/dist/sw.js +4 -2
  52. package/dist/themes/dark.css +1 -0
  53. package/dist/themes/light.css +1 -0
  54. package/dist-dev/cloudcmd.css +2 -10
  55. package/dist-dev/cloudcmd.js +35 -1
  56. package/dist-dev/index.html +3 -0
  57. package/dist-dev/modules/config.js +1 -1
  58. package/dist-dev/sw.js +4 -2
  59. package/dist-dev/themes/dark.css +49 -0
  60. package/dist-dev/themes/light.css +9 -0
  61. package/json/config.json +1 -0
  62. package/json/help.json +1 -0
  63. package/man/cloudcmd.1 +1 -0
  64. package/package.json +1 -1
  65. package/server/cloudcmd.mjs +3 -3
  66. package/server/{columns.js → columns.mjs} +13 -12
  67. package/server/columns.spec.mjs +40 -0
  68. package/server/{route.js → route.mjs} +24 -23
  69. package/server/route.spec.mjs +1 -1
  70. package/server/theme.mjs +33 -0
  71. package/server/themes.spec.mjs +31 -0
  72. package/server/{validate.js → validate.mjs} +24 -10
  73. package/server/validate.spec.mjs +30 -1
  74. package/tmpl/config.hbs +7 -1
@@ -1,13 +1,12 @@
1
- 'use strict';
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
- module.exports.root = (dir, config, {exit = _exit, statSync = _statSync} = {}) => {
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
- module.exports.editor = (name, {exit = _exit} = {}) => {
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
- module.exports.packer = (name, {exit = _exit} = {}) => {
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
- module.exports.columns = (type, {exit = _exit, getColumns = _getColumns} = {}) => {
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
+ };
@@ -1,6 +1,6 @@
1
1
  import {test, stub} from 'supertape';
2
2
  import tryCatch from 'try-catch';
3
- import validate from './validate.js';
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-columns" class="form-control full-width" title="Visible Columns">
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>