@shell-shock/preset-script 0.6.50 → 0.6.52

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 (37) hide show
  1. package/dist/components/bin-entry.cjs +12 -10
  2. package/dist/components/bin-entry.cjs.map +1 -1
  3. package/dist/components/bin-entry.mjs +12 -10
  4. package/dist/components/bin-entry.mjs.map +1 -1
  5. package/dist/components/command-entry.cjs +16 -26
  6. package/dist/components/command-entry.cjs.map +1 -1
  7. package/dist/components/command-entry.d.cts.map +1 -1
  8. package/dist/components/command-entry.d.mts.map +1 -1
  9. package/dist/components/command-entry.mjs +17 -27
  10. package/dist/components/command-entry.mjs.map +1 -1
  11. package/dist/components/virtual-command-entry.cjs +12 -5
  12. package/dist/components/virtual-command-entry.cjs.map +1 -1
  13. package/dist/components/virtual-command-entry.mjs +12 -5
  14. package/dist/components/virtual-command-entry.mjs.map +1 -1
  15. package/dist/helpers/{get-default-options.cjs → get-global-options.cjs} +9 -4
  16. package/dist/helpers/get-global-options.cjs.map +1 -0
  17. package/dist/helpers/get-global-options.d.cts +12 -0
  18. package/dist/helpers/get-global-options.d.cts.map +1 -0
  19. package/dist/helpers/get-global-options.d.mts +12 -0
  20. package/dist/helpers/get-global-options.d.mts.map +1 -0
  21. package/dist/helpers/{get-default-options.mjs → get-global-options.mjs} +9 -4
  22. package/dist/helpers/get-global-options.mjs.map +1 -0
  23. package/dist/index.cjs +7 -6
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.mjs +7 -6
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/types/plugin.d.cts +2 -2
  28. package/dist/types/plugin.d.cts.map +1 -1
  29. package/dist/types/plugin.d.mts +2 -2
  30. package/dist/types/plugin.d.mts.map +1 -1
  31. package/package.json +23 -23
  32. package/dist/helpers/get-default-options.cjs.map +0 -1
  33. package/dist/helpers/get-default-options.d.cts +0 -12
  34. package/dist/helpers/get-default-options.d.cts.map +0 -1
  35. package/dist/helpers/get-default-options.d.mts +0 -12
  36. package/dist/helpers/get-default-options.d.mts.map +0 -1
  37. package/dist/helpers/get-default-options.mjs.map +0 -1
@@ -91,17 +91,24 @@ function VirtualCommandEntry(props) {
91
91
  console: [
92
92
  "warn",
93
93
  "error",
94
- "colors",
95
- "writeLine"
94
+ "writeLine",
95
+ "textColors"
96
96
  ],
97
97
  utils: [
98
- "useApp",
99
- "useArgs",
100
- "hasFlag",
101
98
  "isMinimal",
102
99
  "isUnicodeSupported",
103
100
  "findSuggestions"
104
101
  ],
102
+ state: [
103
+ "useGlobal",
104
+ "withCommand",
105
+ "useArgs",
106
+ "hasFlag",
107
+ {
108
+ name: "GlobalOptions",
109
+ type: true
110
+ }
111
+ ],
105
112
  [joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showHelp"],
106
113
  [joinPaths("banner", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showBanner"]
107
114
  });
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\n command: CommandTree;\n banner?: Children;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"useArgs()\" }]}>\n <Spacing />\n {children}\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n {code`return showHelp(); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\"warn\", \"error\", \"colors\", \"writeLine\"],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"findSuggestions\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,iCAAC,OAAsC;CACrD,MAAA,EACA,SACA,UACF;CAEE,M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A;AACjD,QAAC,KAAQ,MAAC,UAAA,CAAA;KACX,MAAQ;KACX,OAAA,SAAA,WAAA,KAAA;KACD,CAAA;;MAEM,EAAA,CAAA,CAAA;;EAEL,IAAG,iBAAA;AACD,UAAM,KAAI,kBAAA,EAAA,EAAA;IACR,KAAK,CAAC,iBAAc,UAAA;IACpB,SAAS;KAAA;KAAI;KAAA;KAAA;KAAA;IACb,OAAE;KAAA;KAAa;KAAA;KAAA;KAAA;KAAA;KAAA;KACd,UAAQ,QAAQ,GAAA,QAAQ,SAAQ,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,WAAA;KAChC,UAAU,UAAU,GAAG,QAAQ,SAAC,QAAS,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,GAAA,CAAA,aAAA;IAC3C,CAAC;;EAEJ,IAAI,WAAU;AACZ,UAAO,CAAC,gBAAC,SAAA,EAAA,CAAA,EAAA,gBAAA,kCAAA;;IAEP,QAAM,IAAM;IACZ,IAAI,WAAS;AACZ,YAAA,gBAAA,eAAA;MACD,IAAA,WAAgB;AACV,cAAG,QAAA;;MAEP,IAAM,WAAC;AACJ,cAAO,QAAA;;MAET,CAAC;;IAEL,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAI,KAAA;EACP,IAAI,OAAG;AACL,UAAO,OAAK,OAAA,QAAA,SAAA;;EAEd,WAAU,UAAS,gBAAG,MAAqB;GACzC,IAAI,OAAE;AACJ,WAAO,MAAC;;GAEV,IAAI,WAAU;AACZ,WAAO,gBAAiB,cAAM,EAC5B,SAAI,OACL,CAAC;;GAEJ,IAAI,WAAC;AACH,WAAC,gBAAS,qBAAA,EACT,SAAA,OACA,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\n command: CommandTree;\n banner?: Children;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"useArgs()\" }]}>\n <Spacing />\n {children}\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n {code`return showHelp(); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\"warn\", \"error\", \"writeLine\", \"textColors\"],\n utils: [\"isMinimal\", \"isUnicodeSupported\", \"findSuggestions\"],\n state: [\n \"useGlobal\",\n \"withCommand\",\n \"useArgs\",\n \"hasFlag\",\n { name: \"GlobalOptions\", type: true }\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,SAAgB,iCAAC,OAAsC;CACrD,MAAA,EACA,SACA,UACF;CAEE,MAAA,UAAA,eAAA;AACA,QAAG,CAAA,gBAAe,OAAe;EACjC,IAAA,UAAA;AACI,UAAC,OAAS,QAAA,MAAA,IAAA,UAAgC,QAAA,CAAA,GAAA,QAAA,SAAA,KAAA,YAAA,qBAAA,QAAA,GAAA,IAAA,aAAA,0BAAA,QAAA,CAAA,CAAA,KAAA,QAAA,CAAA,KAAA,IAAA,CAAA;;EAE9C,IAAA,WAAA;AACA,UAAQ;IAAA,gBAAmB,cAAgB;AAErC,YAAS,GAAC,QAAA,YAAc,QAAA,QAAsB,GAAA,CAAA;OAEpD,CAAM;IAAC,gBAAA,OAAA,EAAA,CAAA;IAAA,gBAAA,YAAA,EACJ,IAAA,WAAA;AACE,YAAA,QAAA;OAEA,CAAC;IAAE,gBAAc,YAAA;KAChB,MAAI;KACJ,UAAU;KACX,CAAC;IAAC;;EAEN,CAAC,EAAE,gBAAiB,qBAAkB;EACrC,UAAK;EACL,OAAK;EACL,MAAK;EACL,YAAK,CAAA;GACH,MAAE;GACF,MAAC;GACD,SAAE;GACH,CAAC;EACF,IAAI,WAAM;AACR,UAAE;IAAA,gBAAsB,SAAW,EAA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;MACxC,IAAM,WAAC;AACJ,cAAA,QAAU;;MAEX,IAAC,WAAQ;AACR,cAAQ,QAAA;;MAEV,CAAA;;IAEJ,CAAC,CAAC;;EAEN,CAAC,CAAC,EAAE,gBAAkB,KAAC;EACtB,IAAI,OAAI;AACN,UAAO,OAAG,OAAU,QAAA,SAAA;;EAEtB,WAAS,UAAO,gBAAA,MAAA;GACd,IAAI,OAAK;AACP,WAAM,MAAO;;GAEf,IAAI,WAAM;AACR,WAAG,gBAAA,cAAA,EACF,SAAS,OACT,CAAA;;GAEH,IAAI,WAAQ;AACV,WAAG,gBAAA,qBAAA,EACD,SAAE,OACH,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
@@ -2,13 +2,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  let _shell_shock_core = require("@shell-shock/core");
4
4
 
5
- //#region src/helpers/get-default-options.ts
5
+ //#region src/helpers/get-global-options.ts
6
6
  /**
7
7
  * Get the default command options.
8
8
  *
9
9
  * @returns The default command options.
10
10
  */
11
- function getDefaultOptions() {
11
+ function getGlobalOptions() {
12
12
  return [
13
13
  {
14
14
  name: "help",
@@ -19,6 +19,7 @@ function getDefaultOptions() {
19
19
  kind: _shell_shock_core.CommandParameterKinds.boolean,
20
20
  optional: true,
21
21
  default: false,
22
+ variadic: false,
22
23
  skipAddingNegative: true
23
24
  },
24
25
  {
@@ -30,6 +31,7 @@ function getDefaultOptions() {
30
31
  kind: _shell_shock_core.CommandParameterKinds.boolean,
31
32
  optional: true,
32
33
  default: false,
34
+ variadic: false,
33
35
  skipAddingNegative: true
34
36
  },
35
37
  {
@@ -41,6 +43,7 @@ function getDefaultOptions() {
41
43
  kind: _shell_shock_core.CommandParameterKinds.boolean,
42
44
  optional: true,
43
45
  default: false,
46
+ variadic: false,
44
47
  skipAddingNegative: true
45
48
  },
46
49
  {
@@ -51,6 +54,7 @@ function getDefaultOptions() {
51
54
  alias: ["colors"],
52
55
  kind: _shell_shock_core.CommandParameterKinds.boolean,
53
56
  optional: true,
57
+ variadic: false,
54
58
  skipAddingNegative: false
55
59
  },
56
60
  {
@@ -61,11 +65,12 @@ function getDefaultOptions() {
61
65
  alias: ["hide-banner"],
62
66
  kind: _shell_shock_core.CommandParameterKinds.boolean,
63
67
  optional: true,
68
+ variadic: false,
64
69
  default: false
65
70
  }
66
71
  ];
67
72
  }
68
73
 
69
74
  //#endregion
70
- exports.getDefaultOptions = getDefaultOptions;
71
- //# sourceMappingURL=get-default-options.cjs.map
75
+ exports.getGlobalOptions = getGlobalOptions;
76
+ //# sourceMappingURL=get-global-options.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-global-options.cjs","names":["CommandParameterKinds"],"sources":["../../src/helpers/get-global-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getGlobalOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAgB,mBAAoC;AAClD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,UAAU;GACV,SAAS;GACV;EACF"}
@@ -0,0 +1,12 @@
1
+ import { CommandOption } from "@shell-shock/core";
2
+
3
+ //#region src/helpers/get-global-options.d.ts
4
+ /**
5
+ * Get the default command options.
6
+ *
7
+ * @returns The default command options.
8
+ */
9
+ declare function getGlobalOptions(): CommandOption[];
10
+ //#endregion
11
+ export { getGlobalOptions };
12
+ //# sourceMappingURL=get-global-options.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-global-options.d.cts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":";;;;;AA0BA;;;iBAAgB,gBAAA,CAAA,GAAoB,aAAA"}
@@ -0,0 +1,12 @@
1
+ import { CommandOption } from "@shell-shock/core";
2
+
3
+ //#region src/helpers/get-global-options.d.ts
4
+ /**
5
+ * Get the default command options.
6
+ *
7
+ * @returns The default command options.
8
+ */
9
+ declare function getGlobalOptions(): CommandOption[];
10
+ //#endregion
11
+ export { getGlobalOptions };
12
+ //# sourceMappingURL=get-global-options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-global-options.d.mts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":";;;;;AA0BA;;;iBAAgB,gBAAA,CAAA,GAAoB,aAAA"}
@@ -1,12 +1,12 @@
1
1
  import { CommandParameterKinds } from "@shell-shock/core";
2
2
 
3
- //#region src/helpers/get-default-options.ts
3
+ //#region src/helpers/get-global-options.ts
4
4
  /**
5
5
  * Get the default command options.
6
6
  *
7
7
  * @returns The default command options.
8
8
  */
9
- function getDefaultOptions() {
9
+ function getGlobalOptions() {
10
10
  return [
11
11
  {
12
12
  name: "help",
@@ -17,6 +17,7 @@ function getDefaultOptions() {
17
17
  kind: CommandParameterKinds.boolean,
18
18
  optional: true,
19
19
  default: false,
20
+ variadic: false,
20
21
  skipAddingNegative: true
21
22
  },
22
23
  {
@@ -28,6 +29,7 @@ function getDefaultOptions() {
28
29
  kind: CommandParameterKinds.boolean,
29
30
  optional: true,
30
31
  default: false,
32
+ variadic: false,
31
33
  skipAddingNegative: true
32
34
  },
33
35
  {
@@ -39,6 +41,7 @@ function getDefaultOptions() {
39
41
  kind: CommandParameterKinds.boolean,
40
42
  optional: true,
41
43
  default: false,
44
+ variadic: false,
42
45
  skipAddingNegative: true
43
46
  },
44
47
  {
@@ -49,6 +52,7 @@ function getDefaultOptions() {
49
52
  alias: ["colors"],
50
53
  kind: CommandParameterKinds.boolean,
51
54
  optional: true,
55
+ variadic: false,
52
56
  skipAddingNegative: false
53
57
  },
54
58
  {
@@ -59,11 +63,12 @@ function getDefaultOptions() {
59
63
  alias: ["hide-banner"],
60
64
  kind: CommandParameterKinds.boolean,
61
65
  optional: true,
66
+ variadic: false,
62
67
  default: false
63
68
  }
64
69
  ];
65
70
  }
66
71
 
67
72
  //#endregion
68
- export { getDefaultOptions };
69
- //# sourceMappingURL=get-default-options.mjs.map
73
+ export { getGlobalOptions };
74
+ //# sourceMappingURL=get-global-options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-global-options.mjs","names":[],"sources":["../../src/helpers/get-global-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getGlobalOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n variadic: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n variadic: false,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,mBAAoC;AAClD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAM,sBAAsB;GAC5B,UAAU;GACV,UAAU;GACV,SAAS;GACV;EACF"}
package/dist/index.cjs CHANGED
@@ -4,7 +4,7 @@ const require_components_bin_entry = require('./components/bin-entry.cjs');
4
4
  const require_components_command_router = require('./components/command-router.cjs');
5
5
  const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
6
6
  const require_components_command_entry = require('./components/command-entry.cjs');
7
- const require_helpers_get_default_options = require('./helpers/get-default-options.cjs');
7
+ const require_helpers_get_global_options = require('./helpers/get-global-options.cjs');
8
8
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
9
9
  let _alloy_js_core = require("@alloy-js/core");
10
10
  let _alloy_js_typescript = require("@alloy-js/typescript");
@@ -31,7 +31,7 @@ const plugin = (options = {}) => {
31
31
  config() {
32
32
  this.debug("Providing default configuration for the Shell Shock `script` preset.");
33
33
  return {
34
- defaultOptions: require_helpers_get_default_options.getDefaultOptions,
34
+ globalOptions: require_helpers_get_global_options.getGlobalOptions,
35
35
  isCaseSensitive: false,
36
36
  ...options
37
37
  };
@@ -51,13 +51,14 @@ const plugin = (options = {}) => {
51
51
  "stripAnsi",
52
52
  "writeLine",
53
53
  "splitText",
54
- "colors",
55
54
  "help"
56
55
  ],
57
- utils: [
58
- "useApp",
56
+ utils: ["isMinimal"],
57
+ state: [
58
+ "useGlobal",
59
59
  "useArgs",
60
- "isMinimal"
60
+ "hasFlag",
61
+ "isHelp"
61
62
  ]
62
63
  },
63
64
  get children() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;EAAA,4CAAA,QAAA;EAAA,yCAAA,QAAA;EAAA,2CAAA,QAAA,OAAA;EAAA;GACC,MAAQ;GACN,SAAC;AACH,SAAO,MAAA,uEAAA;AACH,WAAC;KACA,gBAAe;KACf,iBAAiB;KACpB,GAAA;KACE;;GAEH;EAAE;GACD,MAAM;GACN,SAAK;;IAEH,MAAE,UAAO;KACP,MAAE,SAAA;AACF,UAAE,MAAA,oEAAsB;AACxB,wDAAK,MAAA,iDAAA,uCAAA;MACJ,gBAAA;OACH,SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;OACD,OAAA;QAAA;QAAA;QAAA;QAAA;OACD;MACM,IAAG,WAAY;AACnB,cAAS;wDAAA,qBAAA;SACD,IAAE,OAAK;AACP,iBAAS,OAAC,KAAA,OAAA,SAAA,CAAA,SAAA;;SAEX,IAAA,WAAU;AACZ,iBAAA;2DAAA,qCAAA;;YAEM,MAAM;YACP,MAAA;YACH,aAAA,mBAAA;YACE,CAAA;2DAAA,OAAA,EAAA,CAAA;2DAAA,iDAAA;YACC,UAAA,EAAc;YACZ,IAAA,WAAS;AACP,oBAAC,OAAQ,YAAA,EAAA;;YAEZ,CAAC;2DAAa,OAAA,EAAA,CAAA;WAAA;;SAElB,CAAC;wDAAc,kDAAA,EAAA,CAAA;QAAA,mBAAA;wDAAA,kDAAA,EAAA,CAAA;QAAA,mBAAA;QAAA;;MAEnB,CAAC,kDAAS,qBAAA;MACT,IAAI,OAAI;AACN,cAAM,OAAA,OAAA,OAAA,SAAA,CAAA,SAAA;;MAER,IAAI,WAAK;AACP,8DAAQ,oBAAA;QACN,IAAI,OAAO;AACT,gBAAI,OAAM,OAAQ,OAAA,SAAA;;QAEpB,gBAAK;QACL,WAAU,0DAAA,qBAAA;SACR,IAAG,OAAA;AACD,iBAAM,MAAA;;SAER,IAAC,WAAS;AACT,iEAAyB,+CAAA,EACzB,SAAS,OACT,CAAA;;SAEF,IAAK,WAAM;AACT,iEAAwB,8DAAgB,EACtC,SAAS,OACT,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getGlobalOptions } from \"./helpers/get-global-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n globalOptions: getGlobalOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"help\"\n ],\n utils: [\"isMinimal\"],\n state: [\"useGlobal\", \"useArgs\", \"hasFlag\", \"isHelp\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;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EACT,SAAY,OACb,CAAA;;SAEA,IAAI,WAAO;AACT,iEAAU,8DAAA,EACR,SAAC,OACF,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { BinEntry } from "./components/bin-entry.mjs";
2
2
  import { CommandRouter } from "./components/command-router.mjs";
3
3
  import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
4
4
  import { CommandEntry } from "./components/command-entry.mjs";
5
- import { getDefaultOptions } from "./helpers/get-default-options.mjs";
5
+ import { getGlobalOptions } from "./helpers/get-global-options.mjs";
6
6
  import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
7
7
  import { For, Show, code } from "@alloy-js/core";
8
8
  import { VarDeclaration } from "@alloy-js/typescript";
@@ -26,7 +26,7 @@ const plugin = (options = {}) => {
26
26
  config() {
27
27
  this.debug("Providing default configuration for the Shell Shock `script` preset.");
28
28
  return {
29
- defaultOptions: getDefaultOptions,
29
+ globalOptions: getGlobalOptions,
30
30
  isCaseSensitive: false,
31
31
  ...options
32
32
  };
@@ -46,13 +46,14 @@ const plugin = (options = {}) => {
46
46
  "stripAnsi",
47
47
  "writeLine",
48
48
  "splitText",
49
- "colors",
50
49
  "help"
51
50
  ],
52
- utils: [
53
- "useApp",
51
+ utils: ["isMinimal"],
52
+ state: [
53
+ "useGlobal",
54
54
  "useArgs",
55
- "isMinimal"
55
+ "hasFlag",
56
+ "isHelp"
56
57
  ]
57
58
  },
58
59
  get children() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useApp\", \"useArgs\", \"isMinimal\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,MAAW,UAA8B,UAAA,EAAA,KAAA;AACxC,QAAA;EAAA,GAAA,QAAA,QAAA;EAAA,GAAA,KAAA,QAAA;EAAA,GAAA,OAAA,QAAA,OAAA;EAAA;GACC,MAAQ;GACN,SAAC;AACH,SAAO,MAAA,uEAAA;AACH,WAAC;KACA,gBAAe;KACf,iBAAiB;KACpB,GAAA;KACE;;GAEH;EAAE;GACD,MAAM;GACN,SAAK;;IAEH,MAAE,UAAO;KACP,MAAE,SAAA;AACF,UAAE,MAAA,oEAAsB;AACxB,YAAK,OAAA,MAAA,CAAA,gBAAA,UAAA;MACJ,gBAAA;OACH,SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;OACD,OAAA;QAAA;QAAA;QAAA;QAAA;OACD;MACM,IAAG,WAAY;AACnB,cAAS;QAAA,gBAAA,MAAA;SACD,IAAE,OAAK;AACP,iBAAS,OAAC,KAAA,OAAA,SAAA,CAAA,SAAA;;SAEX,IAAA,WAAU;AACZ,iBAAA;WAAA,gBAAA,gBAAA;;YAEM,MAAM;YACP,MAAA;YACH,aAAA,IAAA;YACE,CAAA;WAAA,gBAAA,OAAA,EAAA,CAAA;WAAA,gBAAA,eAAA;YACC,UAAA,EAAc;YACZ,IAAA,WAAS;AACP,oBAAC,OAAQ,YAAA,EAAA;;YAEZ,CAAC;WAAE,gBAAW,OAAA,EAAA,CAAA;WAAA;;SAElB,CAAC;QAAE,gBAAY,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA,gBAAA,SAAA,EAAA,CAAA;QAAA,IAAA;QAAA;;MAEnB,CAAC,EAAE,gBAAO,MAAA;MACT,IAAI,OAAI;AACN,cAAM,OAAA,OAAA,OAAA,SAAA,CAAA,SAAA;;MAER,IAAI,WAAK;AACP,cAAO,gBAAC,KAAA;QACN,IAAI,OAAO;AACT,gBAAI,OAAM,OAAQ,OAAA,SAAA;;QAEpB,gBAAK;QACL,WAAU,UAAA,gBAAA,MAAA;SACR,IAAG,OAAA;AACD,iBAAM,MAAA;;SAER,IAAC,WAAS;AACT,iBAAK,gBAAoB,cAAA,EACzB,SAAS,OACT,CAAA;;SAEF,IAAK,WAAM;AACT,iBAAQ,gBAAgB,qBAAgB,EACtC,SAAS,OACT,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport banner from \"@shell-shock/plugin-banner\";\nimport console from \"@shell-shock/plugin-console\";\nimport help from \"@shell-shock/plugin-help\";\nimport type { Plugin } from \"powerlines\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getGlobalOptions } from \"./helpers/get-global-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n ...console<TContext>(options),\n ...help<TContext>(options),\n ...banner<TContext>(options.banner),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n globalOptions: getGlobalOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"help\"\n ],\n utils: [\"isMinimal\"],\n state: [\"useGlobal\", \"useArgs\", \"hasFlag\", \"isHelp\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <Spacing />\n {code`await showBanner();`}\n <Spacing />\n {code`return showHelp();`}\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,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BAAI,MAAA;;SAEN,IAAC,WAAW;AACX,iBAAQ,gBAAC,cAAA,EACT,SAAY,OACb,CAAA;;SAEA,IAAI,WAAO;AACT,iBAAO,gBAAG,qBAAA,EACR,SAAC,OACF,CAAC;;SAEL,CAAC;QACH,CAAC;;MAEL,CAAC,CAAC,CAAC;;IAEP;GACF;EAAC"}
@@ -6,7 +6,7 @@ import { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPlu
6
6
  import { ThemePluginContext, ThemePluginOptions, ThemePluginResolvedConfig, ThemePluginUserConfig } from "@shell-shock/plugin-theme";
7
7
 
8
8
  //#region src/types/plugin.d.ts
9
- type ScriptPresetOptions = Omit<Options, "defaultOptions"> & ThemePluginOptions & ConsolePluginOptions & HelpPluginOptions & {
9
+ type ScriptPresetOptions = Omit<Options, "globalOptions"> & ThemePluginOptions & ConsolePluginOptions & HelpPluginOptions & {
10
10
  /**
11
11
  * A set of default command options to apply to each command.
12
12
  *
@@ -18,7 +18,7 @@ type ScriptPresetOptions = Omit<Options, "defaultOptions"> & ThemePluginOptions
18
18
  *
19
19
  * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
20
20
  */
21
- defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
21
+ globalOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
22
22
  /**
23
23
  * The title to display in the banner for the CLI application. If not specified, the application name will be used.
24
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;KAoDY,mBAAA,GAAsB,IAAA,CAAK,OAAA,sBACrC,kBAAA,GACA,oBAAA,GACA,iBAAA;;AAHF;;;;;;;;;;EAeI,cAAA,GACI,aAAA,OACE,OAAA,EAAS,OAAA,EAAS,KAAA,EAAO,WAAA,KAAgB,aAAA;EAAA;;;EAM/C,MAAA,GAAS,IAAA,CAAK,mBAAA;AAAA;AAAA,KAGN,sBAAA,GAAyB,UAAA,GACnC,mBAAA,GACA,qBAAA,GACA,uBAAA,GACA,oBAAA,GACA,sBAAA;AAAA,KAEU,0BAAA,GAA6B,cAAA,GACvC,mBAAA,GACA,yBAAA,GACA,2BAAA,GACA,wBAAA,GACA,0BAAA;AAAA,KAEU,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,kBAAA,CAAmB,eAAA,IACrB,OAAA,CAAQ,eAAA,IACR,kBAAA,CAAmB,eAAA,IACnB,oBAAA,CAAqB,eAAA,IACrB,iBAAA,CAAkB,eAAA,IAClB,mBAAA,CAAoB,eAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;KAoDY,mBAAA,GAAsB,IAAA,CAAK,OAAA,qBACrC,kBAAA,GACA,oBAAA,GACA,iBAAA;;AAHF;;;;;;;;;;EAeI,aAAA,GACI,aAAA,OACE,OAAA,EAAS,OAAA,EAAS,KAAA,EAAO,WAAA,KAAgB,aAAA;EAAA;;;EAM/C,MAAA,GAAS,IAAA,CAAK,mBAAA;AAAA;AAAA,KAGN,sBAAA,GAAyB,UAAA,GACnC,mBAAA,GACA,qBAAA,GACA,uBAAA,GACA,oBAAA,GACA,sBAAA;AAAA,KAEU,0BAAA,GAA6B,cAAA,GACvC,mBAAA,GACA,yBAAA,GACA,2BAAA,GACA,wBAAA,GACA,0BAAA;AAAA,KAEU,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,kBAAA,CAAmB,eAAA,IACrB,OAAA,CAAQ,eAAA,IACR,kBAAA,CAAmB,eAAA,IACnB,oBAAA,CAAqB,eAAA,IACrB,iBAAA,CAAkB,eAAA,IAClB,mBAAA,CAAoB,eAAA"}
@@ -6,7 +6,7 @@ import { AlloyPluginContext } from "@powerlines/plugin-alloy/types/plugin";
6
6
  import { ThemePluginContext, ThemePluginOptions, ThemePluginResolvedConfig, ThemePluginUserConfig } from "@shell-shock/plugin-theme";
7
7
 
8
8
  //#region src/types/plugin.d.ts
9
- type ScriptPresetOptions = Omit<Options, "defaultOptions"> & ThemePluginOptions & ConsolePluginOptions & HelpPluginOptions & {
9
+ type ScriptPresetOptions = Omit<Options, "globalOptions"> & ThemePluginOptions & ConsolePluginOptions & HelpPluginOptions & {
10
10
  /**
11
11
  * A set of default command options to apply to each command.
12
12
  *
@@ -18,7 +18,7 @@ type ScriptPresetOptions = Omit<Options, "defaultOptions"> & ThemePluginOptions
18
18
  *
19
19
  * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
20
20
  */
21
- defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
21
+ globalOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
22
22
  /**
23
23
  * The title to display in the banner for the CLI application. If not specified, the application name will be used.
24
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;KAoDY,mBAAA,GAAsB,IAAA,CAAK,OAAA,sBACrC,kBAAA,GACA,oBAAA,GACA,iBAAA;;AAHF;;;;;;;;;;EAeI,cAAA,GACI,aAAA,OACE,OAAA,EAAS,OAAA,EAAS,KAAA,EAAO,WAAA,KAAgB,aAAA;EAAA;;;EAM/C,MAAA,GAAS,IAAA,CAAK,mBAAA;AAAA;AAAA,KAGN,sBAAA,GAAyB,UAAA,GACnC,mBAAA,GACA,qBAAA,GACA,uBAAA,GACA,oBAAA,GACA,sBAAA;AAAA,KAEU,0BAAA,GAA6B,cAAA,GACvC,mBAAA,GACA,yBAAA,GACA,2BAAA,GACA,wBAAA,GACA,0BAAA;AAAA,KAEU,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,kBAAA,CAAmB,eAAA,IACrB,OAAA,CAAQ,eAAA,IACR,kBAAA,CAAmB,eAAA,IACnB,oBAAA,CAAqB,eAAA,IACrB,iBAAA,CAAkB,eAAA,IAClB,mBAAA,CAAoB,eAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;KAoDY,mBAAA,GAAsB,IAAA,CAAK,OAAA,qBACrC,kBAAA,GACA,oBAAA,GACA,iBAAA;;AAHF;;;;;;;;;;EAeI,aAAA,GACI,aAAA,OACE,OAAA,EAAS,OAAA,EAAS,KAAA,EAAO,WAAA,KAAgB,aAAA;EAAA;;;EAM/C,MAAA,GAAS,IAAA,CAAK,mBAAA;AAAA;AAAA,KAGN,sBAAA,GAAyB,UAAA,GACnC,mBAAA,GACA,qBAAA,GACA,uBAAA,GACA,oBAAA,GACA,sBAAA;AAAA,KAEU,0BAAA,GAA6B,cAAA,GACvC,mBAAA,GACA,yBAAA,GACA,2BAAA,GACA,wBAAA,GACA,0BAAA;AAAA,KAEU,mBAAA,yBACc,0BAAA,GACtB,0BAAA,IACA,kBAAA,CAAmB,eAAA,IACrB,OAAA,CAAQ,eAAA,IACR,kBAAA,CAAmB,eAAA,IACnB,oBAAA,CAAqB,eAAA,IACrB,iBAAA,CAAkB,eAAA,IAClB,mBAAA,CAAoB,eAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-script",
3
- "version": "0.6.50",
3
+ "version": "0.6.52",
4
4
  "private": false,
5
5
  "description": "A Shell Shock preset that generates a fully-featured script application.",
6
6
  "keywords": [
@@ -143,18 +143,18 @@
143
143
  "default": "./dist/components/virtual-command-entry.mjs"
144
144
  }
145
145
  },
146
- "./helpers/get-default-options": {
146
+ "./helpers/get-global-options": {
147
147
  "require": {
148
- "types": "./dist/helpers/get-default-options.d.cts",
149
- "default": "./dist/helpers/get-default-options.cjs"
148
+ "types": "./dist/helpers/get-global-options.d.cts",
149
+ "default": "./dist/helpers/get-global-options.cjs"
150
150
  },
151
151
  "import": {
152
- "types": "./dist/helpers/get-default-options.d.mts",
153
- "default": "./dist/helpers/get-default-options.mjs"
152
+ "types": "./dist/helpers/get-global-options.d.mts",
153
+ "default": "./dist/helpers/get-global-options.mjs"
154
154
  },
155
155
  "default": {
156
- "types": "./dist/helpers/get-default-options.d.mts",
157
- "default": "./dist/helpers/get-default-options.mjs"
156
+ "types": "./dist/helpers/get-global-options.d.mts",
157
+ "default": "./dist/helpers/get-global-options.mjs"
158
158
  }
159
159
  },
160
160
  "./package.json": "./package.json",
@@ -195,25 +195,25 @@
195
195
  "dependencies": {
196
196
  "@alloy-js/core": "0.23.0-dev.8",
197
197
  "@alloy-js/typescript": "0.23.0-dev.4",
198
- "@powerlines/deepkit": "^0.6.165",
199
- "@powerlines/plugin-alloy": "^0.26.2",
200
- "@powerlines/plugin-plugin": "^0.12.337",
201
- "@shell-shock/core": "^0.15.1",
202
- "@shell-shock/plugin-banner": "^0.1.22",
203
- "@shell-shock/plugin-help": "^0.2.13",
204
- "@shell-shock/plugin-console": "^0.1.35",
205
- "@shell-shock/plugin-theme": "^0.4.8",
206
- "@stryke/helpers": "^0.10.7",
207
- "@stryke/path": "^0.27.3",
208
- "@stryke/string-format": "^0.17.7",
198
+ "@powerlines/deepkit": "^0.6.167",
199
+ "@powerlines/plugin-alloy": "^0.26.9",
200
+ "@powerlines/plugin-plugin": "^0.12.343",
201
+ "@shell-shock/core": "^0.16.0",
202
+ "@shell-shock/plugin-banner": "^0.1.24",
203
+ "@shell-shock/plugin-help": "^0.2.15",
204
+ "@shell-shock/plugin-console": "^0.2.1",
205
+ "@shell-shock/plugin-theme": "^0.4.10",
206
+ "@stryke/helpers": "^0.10.8",
207
+ "@stryke/path": "^0.27.4",
208
+ "@stryke/string-format": "^0.17.9",
209
209
  "defu": "^6.1.6",
210
- "powerlines": "^0.42.27"
210
+ "powerlines": "^0.42.33"
211
211
  },
212
212
  "devDependencies": {
213
213
  "@babel/core": "^7.29.0",
214
- "@powerlines/plugin-alloy": "^0.26.2",
215
- "@types/node": "^25.5.0"
214
+ "@powerlines/plugin-alloy": "^0.26.9",
215
+ "@types/node": "^25.5.2"
216
216
  },
217
217
  "publishConfig": { "access": "public" },
218
- "gitHead": "b39233bcc3bed352f050a2b43ca0fa432a4175a4"
218
+ "gitHead": "99864265fd762dd8a4dcdb5740242469cde2b448"
219
219
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-default-options.cjs","names":["CommandParameterKinds"],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getDefaultOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAgB,oBAAqC;AACnD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAMA,wCAAsB;GAC5B,UAAU;GACV,SAAS;GACV;EACF"}
@@ -1,12 +0,0 @@
1
- import { CommandOption } from "@shell-shock/core";
2
-
3
- //#region src/helpers/get-default-options.d.ts
4
- /**
5
- * Get the default command options.
6
- *
7
- * @returns The default command options.
8
- */
9
- declare function getDefaultOptions(): CommandOption[];
10
- //#endregion
11
- export { getDefaultOptions };
12
- //# sourceMappingURL=get-default-options.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-default-options.d.cts","names":[],"sources":["../../src/helpers/get-default-options.ts"],"mappings":";;;;;AA0BA;;;iBAAgB,iBAAA,CAAA,GAAqB,aAAA"}
@@ -1,12 +0,0 @@
1
- import { CommandOption } from "@shell-shock/core";
2
-
3
- //#region src/helpers/get-default-options.d.ts
4
- /**
5
- * Get the default command options.
6
- *
7
- * @returns The default command options.
8
- */
9
- declare function getDefaultOptions(): CommandOption[];
10
- //#endregion
11
- export { getDefaultOptions };
12
- //# sourceMappingURL=get-default-options.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-default-options.d.mts","names":[],"sources":["../../src/helpers/get-default-options.ts"],"mappings":";;;;;AA0BA;;;iBAAgB,iBAAA,CAAA,GAAqB,aAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-default-options.mjs","names":[],"sources":["../../src/helpers/get-default-options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandOption } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\n\n/**\n * Get the default command options.\n *\n * @returns The default command options.\n */\nexport function getDefaultOptions(): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n env: false,\n alias: [\"h\", \"?\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n env: false,\n alias: [\"v\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n env: \"VERBOSE\",\n alias: [\"V\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"color\",\n title: \"Color\",\n description: \"Enable colored terminal output.\",\n env: \"COLOR\",\n alias: [\"colors\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n skipAddingNegative: false\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.\",\n env: \"NO_BANNER\",\n alias: [\"hide-banner\"],\n kind: CommandParameterKinds.boolean,\n optional: true,\n default: false\n }\n ];\n}\n"],"mappings":";;;;;;;;AA0BA,SAAgB,oBAAqC;AACnD,QAAO;EACL;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,KAAK,IAAI;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,IAAI;GACZ,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACT,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO,CAAC,SAAS;GACjB,MAAM,sBAAsB;GAC5B,UAAU;GACV,oBAAoB;GACrB;EACD;GACE,MAAM;GACN,OAAO;GACP,aACE;GACF,KAAK;GACL,OAAO,CAAC,cAAc;GACtB,MAAM,sBAAsB;GAC5B,UAAU;GACV,SAAS;GACV;EACF"}