@toptal/davinci-cli-shared 1.5.2-alpha-chore-fx-2805-show-workflow-command.111 → 1.5.2-alpha-fx-2755-interactive-workflow-generation.121

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/davinci-cli-shared",
3
- "version": "1.5.2-alpha-chore-fx-2805-show-workflow-command.111+47ccd19e",
3
+ "version": "1.5.2-alpha-fx-2755-interactive-workflow-generation.121+8f62d6c1",
4
4
  "description": "Shared CLI code and CLI engine for davinci",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,5 +20,5 @@
20
20
  "js-yaml": "^4.1.0",
21
21
  "vorpal": "^1.12.0"
22
22
  },
23
- "gitHead": "47ccd19e801f84f149fd43fdafbd309f75ad8697"
23
+ "gitHead": "8f62d6c16d7633620aeeeef6dd21b3f44406c851"
24
24
  }
@@ -7,8 +7,7 @@ const commandsLoader = (commandCreators, vorpalInstance) => {
7
7
  description,
8
8
  options = [],
9
9
  allowUnknownOptions = false,
10
- action,
11
- help
10
+ action
12
11
  } = commandCreator
13
12
 
14
13
  const commandInstance = vorpalInstance
@@ -17,10 +16,6 @@ const commandsLoader = (commandCreators, vorpalInstance) => {
17
16
 
18
17
  options.forEach(option => commandInstance.option(option.name, option.label))
19
18
 
20
- if (help) {
21
- commandInstance.help(help)
22
- }
23
-
24
19
  if (allowUnknownOptions) {
25
20
  commandInstance.allowUnknownOptions()
26
21
  }
@@ -26,38 +26,9 @@ const grey = (...args) => {
26
26
  console.log(chalk.grey(...prettifyObjectIfExist(args)))
27
27
  }
28
28
 
29
- const generatePadding = (str, width, delimiter = ' ') => {
30
- const len = Math.max(0, Math.floor(width) - str.trim().length)
31
-
32
- return str + Array(len + 1).join(delimiter)
33
- }
34
-
35
- /**
36
- * Build a list of commands
37
- * @param commands Array<[name, description]>
38
- */
39
- const prettifyCommands = commands => {
40
- const width = commands.reduce(
41
- (max, commandX) => Math.max(max, commandX[0].length),
42
- 0
43
- )
44
-
45
- return commands
46
- .map(([command, description]) => {
47
- const prefix =
48
- ' ' + chalk.green(generatePadding(command, width)) + ' '
49
- const suffix = generatePadding('', width + 6) + description
50
-
51
- return prefix + suffix
52
- })
53
- .join('\n')
54
- }
55
-
56
29
  module.exports = {
57
30
  green,
58
31
  yellow,
59
32
  red,
60
- grey,
61
- generatePadding,
62
- prettifyCommands
33
+ grey
63
34
  }