@flowscripter/dynamic-cli-framework 2.5.0 → 3.0.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 (109) hide show
  1. package/dist/index.d.ts +2 -2
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/src/command/MultiCommandCliHelpCommand.d.ts +4 -4
  5. package/dist/src/command/MultiCommandCliHelpCommand.d.ts.map +1 -1
  6. package/dist/src/command/MultiCommandCliHelpCommand.js +3 -3
  7. package/dist/src/runtime/command/CommandValidator.d.ts.map +1 -1
  8. package/dist/src/runtime/command/CommandValidator.js +14 -16
  9. package/dist/src/runtime/parser.d.ts +5 -5
  10. package/dist/src/runtime/parser.d.ts.map +1 -1
  11. package/dist/src/runtime/parser.js +2 -2
  12. package/dist/src/runtime/runner.d.ts.map +1 -1
  13. package/dist/src/runtime/values/ValuePopulationResult.d.ts +3 -3
  14. package/dist/src/runtime/values/ValuePopulationResult.d.ts.map +1 -1
  15. package/dist/src/runtime/values/argumentValueMerge.d.ts +2 -2
  16. package/dist/src/runtime/values/argumentValueMerge.d.ts.map +1 -1
  17. package/dist/src/runtime/values/argumentValueValidation.d.ts +4 -4
  18. package/dist/src/runtime/values/argumentValueValidation.d.ts.map +1 -1
  19. package/dist/src/runtime/values/argumentValueValidation.js +6 -6
  20. package/dist/src/runtime/values/globalCommandValuePopulation.d.ts +4 -4
  21. package/dist/src/runtime/values/globalCommandValuePopulation.d.ts.map +1 -1
  22. package/dist/src/runtime/values/globalCommandValuePopulation.js +5 -5
  23. package/dist/src/runtime/values/subCommandValuePopulation.d.ts +5 -5
  24. package/dist/src/runtime/values/subCommandValuePopulation.d.ts.map +1 -1
  25. package/dist/src/runtime/values/subCommandValuePopulation.js +8 -7
  26. package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.d.ts.map +1 -1
  27. package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.js +6 -6
  28. package/dist/src/service/banner/command/NoBannerCommand.d.ts +2 -2
  29. package/dist/src/service/banner/command/NoBannerCommand.d.ts.map +1 -1
  30. package/dist/src/service/banner/command/NoBannerCommand.js +2 -2
  31. package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts +2 -2
  32. package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts.map +1 -1
  33. package/dist/src/service/completion/command/CompletionCompleteSubCommand.js +3 -3
  34. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts +2 -2
  35. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts.map +1 -1
  36. package/dist/src/service/completion/command/CompletionIntegrationSubCommand.js +3 -3
  37. package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts +6 -6
  38. package/dist/src/service/configuration/ConfigurationServiceProvider.d.ts.map +1 -1
  39. package/dist/src/service/configuration/ConfigurationServiceProvider.js +4 -4
  40. package/dist/src/service/configuration/command/ConfigCommand.d.ts +2 -2
  41. package/dist/src/service/configuration/command/ConfigCommand.d.ts.map +1 -1
  42. package/dist/src/service/configuration/command/ConfigCommand.js +2 -2
  43. package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts +4 -4
  44. package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts.map +1 -1
  45. package/dist/src/service/plugin/command/PluginAddSubCommand.js +2 -2
  46. package/dist/src/service/plugin/command/PluginListSubCommand.d.ts +2 -2
  47. package/dist/src/service/plugin/command/PluginListSubCommand.d.ts.map +1 -1
  48. package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts +4 -4
  49. package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts.map +1 -1
  50. package/dist/src/service/plugin/command/PluginRemoveSubCommand.js +2 -2
  51. package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts +4 -4
  52. package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts.map +1 -1
  53. package/dist/src/service/plugin/command/PluginSearchSubCommand.js +2 -2
  54. package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts +2 -2
  55. package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts.map +1 -1
  56. package/dist/src/service/printer/command/DarkModeCommand.d.ts +2 -2
  57. package/dist/src/service/printer/command/DarkModeCommand.d.ts.map +1 -1
  58. package/dist/src/service/printer/command/DarkModeCommand.js +2 -2
  59. package/dist/src/service/printer/command/LogLevelCommand.d.ts +2 -2
  60. package/dist/src/service/printer/command/LogLevelCommand.d.ts.map +1 -1
  61. package/dist/src/service/printer/command/LogLevelCommand.js +2 -2
  62. package/dist/src/service/printer/command/NoColorCommand.d.ts +2 -2
  63. package/dist/src/service/printer/command/NoColorCommand.d.ts.map +1 -1
  64. package/dist/src/service/printer/command/NoColorCommand.js +2 -2
  65. package/dist/src/service/printer/command/NoHyperlinksCommand.d.ts +2 -2
  66. package/dist/src/service/printer/command/NoHyperlinksCommand.d.ts.map +1 -1
  67. package/dist/src/service/printer/command/NoHyperlinksCommand.js +2 -2
  68. package/dist/src/service/prompter/command/NoPromptCommand.d.ts +2 -2
  69. package/dist/src/service/prompter/command/NoPromptCommand.d.ts.map +1 -1
  70. package/dist/src/service/prompter/command/NoPromptCommand.js +2 -2
  71. package/dist/src/service/upgrade/command/UpgradeSubCommand.d.ts +2 -2
  72. package/dist/src/service/upgrade/command/UpgradeSubCommand.d.ts.map +1 -1
  73. package/dist/src/service/upgrade/command/UpgradeSubCommand.js +3 -3
  74. package/dist/src/util/envVarHelper.d.ts +3 -3
  75. package/dist/src/util/envVarHelper.d.ts.map +1 -1
  76. package/dist/src/util/envVarHelper.js +9 -12
  77. package/dist/src/util/helpHelper.d.ts.map +1 -1
  78. package/dist/src/util/helpHelper.js +27 -28
  79. package/index.ts +7 -10
  80. package/package.json +2 -2
  81. package/src/command/MultiCommandCliHelpCommand.ts +7 -7
  82. package/src/runtime/command/CommandValidator.ts +17 -26
  83. package/src/runtime/parser.ts +8 -8
  84. package/src/runtime/runner.ts +16 -19
  85. package/src/runtime/values/ValuePopulationResult.ts +4 -4
  86. package/src/runtime/values/argumentValueMerge.ts +33 -50
  87. package/src/runtime/values/argumentValueValidation.ts +38 -52
  88. package/src/runtime/values/globalCommandValuePopulation.ts +7 -7
  89. package/src/runtime/values/subCommandValuePopulation.ts +42 -47
  90. package/src/service/argumentPrompter/DefaultArgumentPrompterService.ts +23 -26
  91. package/src/service/banner/command/NoBannerCommand.ts +3 -6
  92. package/src/service/completion/command/CompletionCompleteSubCommand.ts +4 -7
  93. package/src/service/completion/command/CompletionIntegrationSubCommand.ts +4 -7
  94. package/src/service/configuration/ConfigurationServiceProvider.ts +21 -21
  95. package/src/service/configuration/command/ConfigCommand.ts +3 -6
  96. package/src/service/plugin/command/PluginAddSubCommand.ts +4 -4
  97. package/src/service/plugin/command/PluginListSubCommand.ts +2 -2
  98. package/src/service/plugin/command/PluginRemoveSubCommand.ts +4 -4
  99. package/src/service/plugin/command/PluginSearchSubCommand.ts +4 -4
  100. package/src/service/plugin/command/PluginUpgradeSubCommand.ts +2 -2
  101. package/src/service/printer/command/DarkModeCommand.ts +3 -6
  102. package/src/service/printer/command/LogLevelCommand.ts +3 -6
  103. package/src/service/printer/command/NoColorCommand.ts +3 -6
  104. package/src/service/printer/command/NoHyperlinksCommand.ts +3 -6
  105. package/src/service/prompter/command/NoPromptCommand.ts +3 -6
  106. package/src/service/prompter/prompt/promptText.ts +2 -2
  107. package/src/service/upgrade/command/UpgradeSubCommand.ts +4 -7
  108. package/src/util/envVarHelper.ts +23 -26
  109. package/src/util/helpHelper.ts +28 -36
@@ -1,7 +1,7 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
4
- import { ArgumentValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
+ import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { Icon, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
7
7
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -16,11 +16,11 @@ export class PluginRemoveSubCommand implements SubCommand {
16
16
  {
17
17
  name: "pluginId",
18
18
  description: "Plugin ID to remove (e.g. @scope/name)",
19
- type: ArgumentValueTypeName.STRING,
19
+ type: ValueTypeName.STRING,
20
20
  },
21
21
  ];
22
22
 
23
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
23
+ async execute(context: Context, argumentValues: Values): Promise<void> {
24
24
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
25
25
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
26
26
 
@@ -1,7 +1,7 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
4
- import { ArgumentValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
+ import { ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
7
7
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -17,12 +17,12 @@ export class PluginSearchSubCommand implements SubCommand {
17
17
  {
18
18
  name: "query",
19
19
  description: "Search query",
20
- type: ArgumentValueTypeName.STRING,
20
+ type: ValueTypeName.STRING,
21
21
  isVarargOptional: true,
22
22
  },
23
23
  ];
24
24
 
25
- async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
25
+ async execute(context: Context, argumentValues: Values): Promise<void> {
26
26
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
27
27
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
28
28
 
@@ -1,6 +1,6 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
3
- import type { ArgumentValues } from "@flowscripter/dynamic-cli-framework-api";
3
+ import type { Values } from "@flowscripter/dynamic-cli-framework-api";
4
4
  import type { PrinterService } from "@flowscripter/dynamic-cli-framework-api";
5
5
  import { Icon, PRINTER_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
6
6
  import { PLUGIN_SERVICE_ID } from "@flowscripter/dynamic-cli-framework-api";
@@ -14,7 +14,7 @@ export class PluginUpgradeSubCommand implements SubCommand {
14
14
  readonly options = [];
15
15
  readonly positionals = [];
16
16
 
17
- async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
17
+ async execute(context: Context, _argumentValues: Values): Promise<void> {
18
18
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
19
19
  const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
20
20
 
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
9
6
 
@@ -15,7 +12,7 @@ export default class DarkModeCommand implements GlobalModifierCommand {
15
12
  readonly description = "Enable dark mode for output";
16
13
  readonly enableConfiguration = true;
17
14
  readonly argument: GlobalCommandArgument = {
18
- type: ArgumentValueTypeName.BOOLEAN,
15
+ type: ValueTypeName.BOOLEAN,
19
16
  defaultValue: false,
20
17
  configurationKey: "DARK_MODE",
21
18
  };
@@ -28,7 +25,7 @@ export default class DarkModeCommand implements GlobalModifierCommand {
28
25
  this.executePriority = executePriority;
29
26
  }
30
27
 
31
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
28
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
32
29
  this.#printerServiceProvider.printerService!.darkMode = argumentValue as boolean;
33
30
 
34
31
  return Promise.resolve();
@@ -1,8 +1,5 @@
1
1
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
2
- import {
3
- type ArgumentSingleValueType,
4
- ArgumentValueTypeName,
5
- } from "@flowscripter/dynamic-cli-framework-api";
2
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
6
3
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
@@ -16,7 +13,7 @@ export default class LogLevelCommand implements GlobalModifierCommand {
16
13
  readonly description = "Set the logging threshold";
17
14
  readonly enableConfiguration = true;
18
15
  readonly argument: GlobalCommandArgument = {
19
- type: ArgumentValueTypeName.STRING,
16
+ type: ValueTypeName.STRING,
20
17
  allowableValues: ["DEBUG", "INFO", "WARN", "ERROR"],
21
18
  isCaseInsensitive: true,
22
19
  defaultValue: "INFO",
@@ -31,7 +28,7 @@ export default class LogLevelCommand implements GlobalModifierCommand {
31
28
  this.executePriority = executePriority;
32
29
  }
33
30
 
34
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
31
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
35
32
  const logLevel = argumentValue as string;
36
33
 
37
34
  switch (logLevel.toUpperCase()) {
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
9
6
 
@@ -15,7 +12,7 @@ export default class NoColorCommand implements GlobalModifierCommand {
15
12
  readonly description = "Disable color for output";
16
13
  readonly enableConfiguration = true;
17
14
  readonly argument: GlobalCommandArgument = {
18
- type: ArgumentValueTypeName.BOOLEAN,
15
+ type: ValueTypeName.BOOLEAN,
19
16
  defaultValue: false,
20
17
  configurationKey: "NO_COLOR",
21
18
  };
@@ -28,7 +25,7 @@ export default class NoColorCommand implements GlobalModifierCommand {
28
25
  this.executePriority = executePriority;
29
26
  }
30
27
 
31
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
28
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
32
29
  this.#printerServiceProvider.printerService!.colorEnabled = !argumentValue as boolean;
33
30
 
34
31
  return Promise.resolve();
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrinterServiceProvider from "../PrinterServiceProvider.ts";
9
6
 
@@ -12,7 +9,7 @@ export default class NoHyperlinksCommand implements GlobalModifierCommand {
12
9
  readonly description = "Disable hyperlinks for output";
13
10
  readonly enableConfiguration = true;
14
11
  readonly argument: GlobalCommandArgument = {
15
- type: ArgumentValueTypeName.BOOLEAN,
12
+ type: ValueTypeName.BOOLEAN,
16
13
  defaultValue: false,
17
14
  configurationKey: "NO_HYPERLINKS",
18
15
  };
@@ -25,7 +22,7 @@ export default class NoHyperlinksCommand implements GlobalModifierCommand {
25
22
  this.executePriority = executePriority;
26
23
  }
27
24
 
28
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
25
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
29
26
  this.#printerServiceProvider.printerService!.hyperlinksEnabled = !argumentValue as boolean;
30
27
 
31
28
  return Promise.resolve();
@@ -1,9 +1,6 @@
1
1
  import type { GlobalModifierCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
3
- import {
4
- type ArgumentSingleValueType,
5
- ArgumentValueTypeName,
6
- } from "@flowscripter/dynamic-cli-framework-api";
3
+ import { type SingleValueType, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
7
4
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type PrompterServiceProvider from "../PrompterServiceProvider.ts";
9
6
 
@@ -12,7 +9,7 @@ export default class NoPromptCommand implements GlobalModifierCommand {
12
9
  readonly description = "Disable interactive prompting";
13
10
  readonly enableConfiguration = true;
14
11
  readonly argument: GlobalCommandArgument = {
15
- type: ArgumentValueTypeName.BOOLEAN,
12
+ type: ValueTypeName.BOOLEAN,
16
13
  defaultValue: false,
17
14
  configurationKey: "NO_PROMPT",
18
15
  };
@@ -25,7 +22,7 @@ export default class NoPromptCommand implements GlobalModifierCommand {
25
22
  this.executePriority = executePriority;
26
23
  }
27
24
 
28
- public execute(_context: Context, argumentValue: ArgumentSingleValueType): Promise<void> {
25
+ public execute(_context: Context, argumentValue: SingleValueType): Promise<void> {
29
26
  this.#prompterServiceProvider.prompterService.promptEnabled = !(argumentValue as boolean);
30
27
 
31
28
  return Promise.resolve();
@@ -1,5 +1,5 @@
1
1
  import type { Prompt, PromptResult } from "@flowscripter/dynamic-cli-framework-api";
2
- import type { ArgumentSingleValueType } from "@flowscripter/dynamic-cli-framework-api";
2
+ import type { SingleValueType } from "@flowscripter/dynamic-cli-framework-api";
3
3
  import { SpecialKey } from "../../../terminal/KeyReader.ts";
4
4
  import ShutdownServiceProvider from "../../shutdown/ShutdownServiceProvider.ts";
5
5
  import { renderPromptHeader } from "./PromptContext.ts";
@@ -52,7 +52,7 @@ export default async function promptText(
52
52
  continue;
53
53
  }
54
54
 
55
- const value: ArgumentSingleValueType = buffer;
55
+ const value: SingleValueType = buffer;
56
56
 
57
57
  const validationOption = promptDef.options.length > 0 ? promptDef.options[0] : undefined;
58
58
  if (validationOption?.validate) {
@@ -1,10 +1,7 @@
1
1
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
2
2
  import type { Option } from "@flowscripter/dynamic-cli-framework-api";
3
3
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
4
- import {
5
- type ArgumentValues,
6
- ArgumentValueTypeName,
7
- } from "@flowscripter/dynamic-cli-framework-api";
4
+ import { type Values, ValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import {
9
6
  Icon,
10
7
  InstallMethod,
@@ -24,14 +21,14 @@ export class UpgradeSubCommand implements SubCommand {
24
21
  readonly options: ReadonlyArray<Option> = [
25
22
  {
26
23
  name: "os",
27
- type: ArgumentValueTypeName.STRING,
24
+ type: ValueTypeName.STRING,
28
25
  isOptional: true,
29
26
  allowableValues: Object.values(SupportedOs),
30
27
  description: "Override the detected operating system",
31
28
  },
32
29
  {
33
30
  name: "install-method",
34
- type: ArgumentValueTypeName.STRING,
31
+ type: ValueTypeName.STRING,
35
32
  isOptional: true,
36
33
  allowableValues: Object.values(InstallMethod),
37
34
  description: "Override the detected install method",
@@ -44,7 +41,7 @@ export class UpgradeSubCommand implements SubCommand {
44
41
  this.#upgradeService = upgradeService;
45
42
  }
46
43
 
47
- public async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
44
+ public async execute(context: Context, argumentValues: Values): Promise<void> {
48
45
  const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
49
46
  const cliName = context.cliConfig.name;
50
47
 
@@ -2,10 +2,10 @@ import process from "node:process";
2
2
  import type { Command } from "@flowscripter/dynamic-cli-framework-api";
3
3
  import type { CLIConfig } from "@flowscripter/dynamic-cli-framework-api";
4
4
  import {
5
- ArgumentValueTypeName,
5
+ ValueTypeName,
6
6
  ComplexValueTypeName,
7
- type PopulatedArgumentSingleValueType,
8
- type PopulatedArgumentValues,
7
+ type PopulatedSingleValueType,
8
+ type PopulatedValues,
9
9
  } from "@flowscripter/dynamic-cli-framework-api";
10
10
  type ProcessEnv = NodeJS.ProcessEnv;
11
11
 
@@ -59,7 +59,7 @@ function getGlobalArgumentKeyPrefix(
59
59
  export function getGlobalCommandValueFromEnvVars(
60
60
  cliConfig: CLIConfig,
61
61
  command: GlobalCommand,
62
- ): PopulatedArgumentSingleValueType {
62
+ ): PopulatedSingleValueType {
63
63
  const { argument } = command;
64
64
  if (argument === undefined) {
65
65
  return undefined;
@@ -67,7 +67,7 @@ export function getGlobalCommandValueFromEnvVars(
67
67
 
68
68
  // simple check for a specific env var name
69
69
  let envVarValue = process.env[getGlobalArgumentKeyPrefix(cliConfig, command, argument)];
70
- if (envVarValue != undefined && argument.type === ArgumentValueTypeName.BOOLEAN) {
70
+ if (envVarValue != undefined && argument.type === ValueTypeName.BOOLEAN) {
71
71
  envVarValue = envVarValue.length > 0 ? "true" : "false";
72
72
  }
73
73
 
@@ -75,7 +75,7 @@ export function getGlobalCommandValueFromEnvVars(
75
75
  }
76
76
 
77
77
  function getOptionValuesFromEnvVars(
78
- envVarValues: PopulatedArgumentValues,
78
+ envVarValues: PopulatedValues,
79
79
  potentialEnvVarNames: Array<string>,
80
80
  env: ProcessEnv,
81
81
  option: Option | ComplexOption,
@@ -126,17 +126,16 @@ function getOptionValuesFromEnvVars(
126
126
  if (suffix.length > 0) {
127
127
  if (option.type === ComplexValueTypeName.COMPLEX) {
128
128
  if (
129
- (envVarValues[option.name] as Array<PopulatedArgumentSingleValueType>)[index] ===
130
- undefined
129
+ (envVarValues[option.name] as Array<PopulatedSingleValueType>)[index] === undefined
131
130
  ) {
132
- (envVarValues[option.name] as Array<PopulatedArgumentValues>)[index] = Object.create(
131
+ (envVarValues[option.name] as Array<PopulatedValues>)[index] = Object.create(
133
132
  null,
134
- ) as PopulatedArgumentValues;
133
+ ) as PopulatedValues;
135
134
  }
136
135
  (option as ComplexOption).properties.forEach((property) => {
137
136
  const propertySegment = property.configurationKey || getKeySegment(property.name);
138
137
  getOptionValuesFromEnvVars(
139
- (envVarValues[option.name] as Array<PopulatedArgumentValues>)[index]!,
138
+ (envVarValues[option.name] as Array<PopulatedValues>)[index]!,
140
139
  matches,
141
140
  env,
142
141
  property,
@@ -145,13 +144,13 @@ function getOptionValuesFromEnvVars(
145
144
  });
146
145
  if (
147
146
  Object.keys(
148
- (envVarValues[option.name] as Array<PopulatedArgumentValues>)[index] as Record<
147
+ (envVarValues[option.name] as Array<PopulatedValues>)[index] as Record<
149
148
  string,
150
149
  string
151
150
  >,
152
151
  ).length === 0
153
152
  ) {
154
- delete (envVarValues[option.name] as Array<PopulatedArgumentValues>)[index];
153
+ delete (envVarValues[option.name] as Array<PopulatedValues>)[index];
155
154
  }
156
155
  } else {
157
156
  throw new Error(`Unidentified suffix ${suffix} in env var: ${match}`);
@@ -161,14 +160,13 @@ function getOptionValuesFromEnvVars(
161
160
  } else {
162
161
  // set primitive value
163
162
  let envVarValue = env[match];
164
- if (envVarValue != undefined && option.type === ArgumentValueTypeName.BOOLEAN) {
163
+ if (envVarValue != undefined && option.type === ValueTypeName.BOOLEAN) {
165
164
  envVarValue = envVarValue.length > 1 ? "true" : "false";
166
165
  }
167
- (envVarValues[option.name] as Array<PopulatedArgumentSingleValueType>)[index] =
168
- envVarValue;
166
+ (envVarValues[option.name] as Array<PopulatedSingleValueType>)[index] = envVarValue;
169
167
  }
170
168
 
171
- const elements = envVarValues[option.name] as Array<PopulatedArgumentSingleValueType>;
169
+ const elements = envVarValues[option.name] as Array<PopulatedSingleValueType>;
172
170
  for (let i = elements.length - 1; i > -1; i--) {
173
171
  if (elements[i] === undefined) {
174
172
  elements.length = i;
@@ -182,11 +180,11 @@ function getOptionValuesFromEnvVars(
182
180
  } else if (option.type === ComplexValueTypeName.COMPLEX) {
183
181
  (option as ComplexOption).properties.forEach((property) => {
184
182
  if (envVarValues[option.name] === undefined) {
185
- envVarValues[option.name] = Object.create(null) as PopulatedArgumentValues;
183
+ envVarValues[option.name] = Object.create(null) as PopulatedValues;
186
184
  }
187
185
  const propertySegment = property.configurationKey || getKeySegment(property.name);
188
186
  getOptionValuesFromEnvVars(
189
- envVarValues[option.name] as PopulatedArgumentValues,
187
+ envVarValues[option.name] as PopulatedValues,
190
188
  potentialEnvVarNames,
191
189
  env,
192
190
  property,
@@ -202,7 +200,7 @@ function getOptionValuesFromEnvVars(
202
200
  if (value === undefined) {
203
201
  return undefined;
204
202
  }
205
- if (option.type === ArgumentValueTypeName.BOOLEAN) {
203
+ if (option.type === ValueTypeName.BOOLEAN) {
206
204
  value = value.length > 1 ? "true" : "false";
207
205
  }
208
206
  // set primitive value
@@ -220,8 +218,8 @@ function getOptionValuesFromEnvVars(
220
218
  export function getSubCommandValuesFromEnvVars(
221
219
  cliConfig: CLIConfig,
222
220
  command: SubCommand,
223
- ): PopulatedArgumentValues | undefined {
224
- const envVarValues = Object.create(null) as PopulatedArgumentValues;
221
+ ): PopulatedValues | undefined {
222
+ const envVarValues = Object.create(null) as PopulatedValues;
225
223
  if (command.options) {
226
224
  for (const option of command.options) {
227
225
  const potentialEnvVarNames = Object.keys(process.env);
@@ -270,11 +268,10 @@ export function getSubCommandValuesFromEnvVars(
270
268
  }
271
269
  // set primitive value
272
270
  let envVarValue = process.env[match];
273
- if (envVarValue != undefined && positional.type === ArgumentValueTypeName.BOOLEAN) {
271
+ if (envVarValue != undefined && positional.type === ValueTypeName.BOOLEAN) {
274
272
  envVarValue = envVarValue.length > 1 ? "true" : "false";
275
273
  }
276
- (envVarValues[positional.name] as Array<PopulatedArgumentSingleValueType>)[index] =
277
- envVarValue;
274
+ (envVarValues[positional.name] as Array<PopulatedSingleValueType>)[index] = envVarValue;
278
275
  }
279
276
  });
280
277
  } else {
@@ -283,7 +280,7 @@ export function getSubCommandValuesFromEnvVars(
283
280
  if (value === undefined) {
284
281
  return undefined;
285
282
  }
286
- if (positional.type === ArgumentValueTypeName.BOOLEAN) {
283
+ if (positional.type === ValueTypeName.BOOLEAN) {
287
284
  value = value.length > 1 ? "true" : "false";
288
285
  }
289
286
  // set primitive value
@@ -1,10 +1,7 @@
1
1
  import { distance } from "fastest-levenshtein";
2
2
  import type { GlobalCommand } from "@flowscripter/dynamic-cli-framework-api";
3
3
  import type { GlobalCommandArgument } from "@flowscripter/dynamic-cli-framework-api";
4
- import {
5
- ArgumentValueTypeName,
6
- ComplexValueTypeName,
7
- } from "@flowscripter/dynamic-cli-framework-api";
4
+ import { ValueTypeName, ComplexValueTypeName } from "@flowscripter/dynamic-cli-framework-api";
8
5
  import type { SubCommand } from "@flowscripter/dynamic-cli-framework-api";
9
6
  import type { Context } from "@flowscripter/dynamic-cli-framework-api";
10
7
  import type { UsageExample } from "@flowscripter/dynamic-cli-framework-api";
@@ -144,24 +141,21 @@ function getGlobalCommandArgumentForm(globalCommandArgument: GlobalCommandArgume
144
141
  let argumentSyntax = "";
145
142
 
146
143
  switch (globalCommandArgument.type) {
147
- case ArgumentValueTypeName.BOOLEAN:
144
+ case ValueTypeName.BOOLEAN:
148
145
  argumentSyntax = "true|false";
149
146
  break;
150
- case ArgumentValueTypeName.INTEGER:
147
+ case ValueTypeName.INTEGER:
151
148
  argumentSyntax = "<integer_value>";
152
149
  break;
153
- case ArgumentValueTypeName.NUMBER:
150
+ case ValueTypeName.NUMBER:
154
151
  argumentSyntax = "<number_value>";
155
152
  break;
156
- case ArgumentValueTypeName.STRING:
153
+ case ValueTypeName.STRING:
157
154
  argumentSyntax = "<string_value>";
158
155
  break;
159
156
  }
160
157
 
161
- if (
162
- globalCommandArgument.isOptional ||
163
- globalCommandArgument.type === ArgumentValueTypeName.BOOLEAN
164
- ) {
158
+ if (globalCommandArgument.isOptional || globalCommandArgument.type === ValueTypeName.BOOLEAN) {
165
159
  argumentSyntax = `[${argumentSyntax}]`;
166
160
  }
167
161
 
@@ -187,13 +181,13 @@ export function getGlobalArgumentHelpEntry(
187
181
  notesItems.push(`valid values: ${argument.allowableValues.join("|")}`);
188
182
  } else {
189
183
  switch (argument.type) {
190
- case ArgumentValueTypeName.STRING:
184
+ case ValueTypeName.STRING:
191
185
  notesItems.push("string value");
192
186
  break;
193
- case ArgumentValueTypeName.INTEGER:
187
+ case ValueTypeName.INTEGER:
194
188
  notesItems.push("integer value");
195
189
  break;
196
- case ArgumentValueTypeName.NUMBER:
190
+ case ValueTypeName.NUMBER:
197
191
  notesItems.push("number value");
198
192
  break;
199
193
  }
@@ -240,17 +234,17 @@ export function getSubCommandArgumentsSyntax(subCommand: SubCommand): string {
240
234
 
241
235
  subCommand.options.forEach((option) => {
242
236
  let optionSyntax = `--${option.name}`;
243
- switch (option.type as ArgumentValueTypeName | ComplexValueTypeName) {
244
- case ArgumentValueTypeName.BOOLEAN:
237
+ switch (option.type as ValueTypeName | ComplexValueTypeName) {
238
+ case ValueTypeName.BOOLEAN:
245
239
  optionSyntax = `${optionSyntax} [true|false]`;
246
240
  break;
247
- case ArgumentValueTypeName.INTEGER:
241
+ case ValueTypeName.INTEGER:
248
242
  optionSyntax = `${optionSyntax} <integer_value>`;
249
243
  break;
250
- case ArgumentValueTypeName.NUMBER:
244
+ case ValueTypeName.NUMBER:
251
245
  optionSyntax = `${optionSyntax} <number_value>`;
252
246
  break;
253
- case ArgumentValueTypeName.STRING:
247
+ case ValueTypeName.STRING:
254
248
  optionSyntax = `${optionSyntax} <string_value>`;
255
249
  break;
256
250
  case ComplexValueTypeName.COMPLEX:
@@ -318,16 +312,16 @@ function getOptionHelpEntry(
318
312
  notesItems.push(`valid values: ${option.allowableValues.join("|")}`);
319
313
  } else {
320
314
  switch (option.type) {
321
- case ArgumentValueTypeName.STRING:
315
+ case ValueTypeName.STRING:
322
316
  notesItems.push(`string value`);
323
317
  break;
324
- case ArgumentValueTypeName.INTEGER:
318
+ case ValueTypeName.INTEGER:
325
319
  notesItems.push(`integer value`);
326
320
  break;
327
- case ArgumentValueTypeName.NUMBER:
321
+ case ValueTypeName.NUMBER:
328
322
  notesItems.push(`number value`);
329
323
  break;
330
- case ArgumentValueTypeName.BOOLEAN:
324
+ case ValueTypeName.BOOLEAN:
331
325
  notesItems.push(`boolean value`);
332
326
  break;
333
327
  }
@@ -403,16 +397,16 @@ function getPositionalHelpEntry(
403
397
  notesItems.push(`valid values: ${positional.allowableValues.join("|")}`);
404
398
  } else {
405
399
  switch (positional.type) {
406
- case ArgumentValueTypeName.STRING:
400
+ case ValueTypeName.STRING:
407
401
  notesItems.push(`string value`);
408
402
  break;
409
- case ArgumentValueTypeName.INTEGER:
403
+ case ValueTypeName.INTEGER:
410
404
  notesItems.push(`integer value`);
411
405
  break;
412
- case ArgumentValueTypeName.NUMBER:
406
+ case ValueTypeName.NUMBER:
413
407
  notesItems.push(`number value`);
414
408
  break;
415
- case ArgumentValueTypeName.BOOLEAN:
409
+ case ValueTypeName.BOOLEAN:
416
410
  notesItems.push(`boolean value`);
417
411
  break;
418
412
  }
@@ -544,7 +538,7 @@ export function getMultiCommandAppSyntax(
544
538
  modifier.argument !== undefined &&
545
539
  !modifier.argument.isOptional &&
546
540
  modifier.argument.defaultValue === undefined &&
547
- modifier.argument.type !== ArgumentValueTypeName.BOOLEAN,
541
+ modifier.argument.type !== ValueTypeName.BOOLEAN,
548
542
  );
549
543
  syntax += optionArgMandatory ? " <value>" : " [<value>]";
550
544
  }
@@ -571,7 +565,7 @@ export function getMultiCommandAppSyntax(
571
565
  argValueOptional = globalCommands.some(
572
566
  (globalCommand) =>
573
567
  globalCommand.argument !== undefined &&
574
- globalCommand.argument.type === ArgumentValueTypeName.BOOLEAN,
568
+ globalCommand.argument.type === ValueTypeName.BOOLEAN,
575
569
  );
576
570
  }
577
571
  }
@@ -623,19 +617,17 @@ export function getMultiCommandAppSyntax(
623
617
  groupCommand.memberSubCommands.some((memberCommand) =>
624
618
  memberCommand.options.some(
625
619
  (option) =>
626
- option.type === ArgumentValueTypeName.BOOLEAN ||
620
+ option.type === ValueTypeName.BOOLEAN ||
627
621
  memberCommand.positionals.some(
628
- (positional) => positional.type === ArgumentValueTypeName.BOOLEAN,
622
+ (positional) => positional.type === ValueTypeName.BOOLEAN,
629
623
  ),
630
624
  ),
631
625
  ),
632
626
  ) ||
633
627
  subCommands.some(
634
628
  (subCommand) =>
635
- subCommand.options.some((option) => option.type === ArgumentValueTypeName.BOOLEAN) ||
636
- subCommand.positionals.some(
637
- (positional) => positional.type === ArgumentValueTypeName.BOOLEAN,
638
- ),
629
+ subCommand.options.some((option) => option.type === ValueTypeName.BOOLEAN) ||
630
+ subCommand.positionals.some((positional) => positional.type === ValueTypeName.BOOLEAN),
639
631
  );
640
632
  multipleArg =
641
633
  multipleArg ||