@shell-shock/preset-script 0.6.23 → 0.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/banner-function-declaration.cjs +28 -27
- package/dist/components/banner-function-declaration.cjs.map +1 -1
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +2 -2
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/bin-entry.cjs +54 -45
- package/dist/components/bin-entry.cjs.map +1 -1
- package/dist/components/bin-entry.d.cts +0 -1
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts +0 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +17 -9
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.cjs +76 -235
- package/dist/components/command-entry.cjs.map +1 -1
- package/dist/components/command-entry.d.cts +1 -8
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -9
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +24 -183
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +85 -83
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +59 -58
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/exit-function-declaration.cjs +38 -37
- package/dist/components/exit-function-declaration.cjs.map +1 -1
- package/dist/components/exit-function-declaration.d.cts +2 -2
- package/dist/components/exit-function-declaration.d.cts.map +1 -1
- package/dist/components/exit-function-declaration.d.mts +2 -2
- package/dist/components/exit-function-declaration.d.mts.map +1 -1
- package/dist/components/exit-function-declaration.mjs +3 -3
- package/dist/components/exit-function-declaration.mjs.map +1 -1
- package/dist/components/index.cjs +2 -9
- package/dist/components/index.d.cts +2 -3
- package/dist/components/index.d.mts +2 -3
- package/dist/components/index.mjs +2 -3
- package/dist/components/virtual-command-entry.cjs +43 -59
- package/dist/components/virtual-command-entry.cjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +13 -30
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +8 -7
- package/dist/helpers/get-default-options.cjs.map +1 -1
- package/dist/helpers/get-default-options.d.cts +0 -1
- package/dist/helpers/get-default-options.d.cts.map +1 -1
- package/dist/helpers/get-default-options.d.mts +0 -1
- package/dist/helpers/get-default-options.d.mts.map +1 -1
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +30 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -20
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/components/display.cjs +260 -0
- package/dist/plugin-help/dist/components/display.cjs.map +1 -0
- package/dist/{components/help.mjs → plugin-help/dist/components/display.mjs} +26 -30
- package/dist/plugin-help/dist/components/display.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs +86 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs +84 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.cjs +97 -0
- package/dist/plugin-help/dist/components/help-command.cjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.mjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs.map +1 -0
- package/dist/plugin-help/dist/components/index.cjs +3 -0
- package/dist/plugin-help/dist/components/index.mjs +5 -0
- package/dist/plugin-help/dist/index.cjs +104 -0
- package/dist/plugin-help/dist/index.cjs.map +1 -0
- package/dist/plugin-help/dist/index.d.cts +2 -0
- package/dist/plugin-help/dist/index.d.mts +2 -0
- package/dist/plugin-help/dist/index.mjs +100 -0
- package/dist/plugin-help/dist/index.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +18 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +39 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +18 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +13 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +13 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +9 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.cts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.mts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.d.cts +9 -9
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +9 -9
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +15 -29
- package/dist/components/help.cjs +0 -264
- package/dist/components/help.cjs.map +0 -1
- package/dist/components/help.d.cts +0 -105
- package/dist/components/help.d.cts.map +0 -1
- package/dist/components/help.d.mts +0 -105
- package/dist/components/help.d.mts.map +0 -1
- package/dist/components/help.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.mjs","names":["code","computed","For","Show","Spacing","usePowerlines","CommandParameterKinds","formatDescription","formatShortDescription","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","sortOptions","useTheme","kebabCase","snakeCase","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","segments","length","map","segment","join","values","args","arg","kind","string","number","choices","format","name","variadic","padding","app","_$createIntrinsic","when","HelpOptions","options","option","flags","names","push","alias","forEach","sort","description","replace","trim","env","default","undefined","appSpecificEnvPrefix","JSON","stringify","HelpCommands","commands","child","BaseHelp","filterGlobalOptions","filter","some","globalOption","includes","value","VirtualHelp","doubleHardline","joiner","ender","icon","title","isVirtual","CommandHelp"],"sources":["../../src/components/help.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, computed, For, Show } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { CommandOption, CommandTree } from \"@shell-shock/core\";\nimport { CommandParameterKinds } from \"@shell-shock/core\";\nimport {\n formatDescription,\n formatShortDescription,\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n sortOptions\n} from \"@shell-shock/core/plugin-utils\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <>\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"}${\n command.args.length > 0\n ? ` ${command.args\n .map(\n arg =>\n `\\${colors.text.usage.args(\"<${snakeCase(\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.choices &&\n arg.choices.length > 0\n ? arg.choices.join(\"|\")\n : arg.kind === CommandParameterKinds.string &&\n arg.format\n ? arg.format\n : arg.name\n )}${\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n } \\${colors.text.usage.options(\"[options]\")}\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n <Show when={command.args.length > 0}>\n <hbr />\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"} \\${colors.text.usage.options(\"[options]\")}${\n command.args.length > 0\n ? ` ${command.args\n .map(\n arg =>\n `\\${colors.text.usage.args(\"<${snakeCase(\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.choices &&\n arg.choices.length > 0\n ? arg.choices.join(\"|\")\n : arg.kind === CommandParameterKinds.string &&\n arg.format\n ? arg.format\n : arg.name\n )}${\n (arg.kind === CommandParameterKinds.string ||\n arg.kind === CommandParameterKinds.number) &&\n arg.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n }\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n </Show>\n </>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === CommandParameterKinds.string\n ? ` <${snakeCase(\n option.choices && option.choices.length > 0\n ? option.choices.join(\"|\")\n : option.format\n ? option.format\n : option.name\n )}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === CommandParameterKinds.number\n ? ` <${snakeCase(\n option.choices && option.choices.length > 0\n ? option.choices.join(\"|\")\n : option.name\n )}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\", maxWidth: \"1/3\" }, { value: colors.text.body.tertiary(\\`${formatShortDescription(\n option.description\n )\n .replace(/\\.+$/, \"\")\n .trim()}${\n option.env || option.default !== undefined\n ? ` (${\n option.env\n ? `env: ${context.config.appSpecificEnvPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default).replace(/\"/g, '\\\\\"')}`\n : \"\"\n })`\n : \"\"\n }.\\`), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\\`${formatShortDescription(\n child.description\n )\n .replace(/\\.+$/, \"\")\n .trim()}.\\`), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface BaseHelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * Whether to filter out global options from the help display.\n *\n * @remarks\n * When enabled, any options that are present in the global options context will be filtered out from the help display. This is useful for sub-commands to avoid displaying global options that are not relevant to the specific command.\n *\n * @defaultValue false\n */\n filterGlobalOptions?: boolean;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function BaseHelp(props: BaseHelpProps) {\n const { command, indent = 1, filterGlobalOptions = false } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(() =>\n filterGlobalOptions\n ? Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n )\n : Object.values(command.options)\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <Spacing />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n\nexport interface VirtualHelpProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n\n /**\n * The command path to generate help for, used for generating the help invocation instructions.\n *\n * @remarks\n * This is optional since the virtual command entry component can be used for both the global binary executable and virtual commands (there will be no command definition for the binary executable).\n */\n segments?: string[];\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function VirtualHelp(props: VirtualHelpProps) {\n const { options, segments, commands } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <hbr />\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`}\n <hbr />\n <HelpOptions options={options} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(splitText(\\`${formatDescription(\n child.description\n )\n .replace(/\\.+$/, \"\")\n .trim()}.\\`)));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )}${\n segments && segments.length > 0 ? ` ${segments.join(\" \")}` : \"\"\n } <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n\nexport interface CommandHelpProps {\n /**\n * A mapping of command names to their command definitions.\n */\n command: CommandTree;\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function CommandHelp(props: CommandHelpProps) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`writeLine(\"\"); `}\n <Spacing />\n <BaseHelp command={command} filterGlobalOptions={false} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following sub-commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(command.children)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(splitText(\\`${formatDescription(\n child.description\n )\n .replace(/\\.+$/, \"\")\n .trim()}.\\`)));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )} ${command.segments.join(\n \" \"\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAwDA,SAAgBgB,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,UAAUf,eAAoC;CACpD,MAAMgB,QAAQR,UAAU;AAExB,QAAA,CAAAS,gBAEKpB,KAAG;EAAA,IAACqB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QAAG,CAAAG,WAEC9B,IAAI;;oEAEmD2B,IAAG,KAC7DT,QAAQa,SAASC,SAAS,IACtB,IAAId,QAAQa,SACTE,KACCC,YACE,wBAAwBvB,qBAAqBuB,QAAQ,GAAG,YAAY,UAAS,IAC3EvB,qBAAqBuB,QAAQ,GACzB,IAAInB,UAAUL,0BAA0BwB,QAAQ,CAAC,CAAA,KACjDA,QAAO,KAEhB,CACAC,KAAK,IAAI,KACZ,KACHX,OAAOY,OAAOlB,QAAQW,SAAS,CAACG,SAAS,IAAI,gDAAgD,KAC9Fd,QAAQmB,KAAKL,SAAS,IAClB,IAAId,QAAQmB,KACTJ,KACCK,QACE,+BAA+BvB,WAC5BuB,IAAIC,SAASjC,sBAAsBkC,UAClCF,IAAIC,SAASjC,sBAAsBmC,WACnCH,IAAII,WACJJ,IAAII,QAAQV,SAAS,IACnBM,IAAII,QAAQP,KAAK,IAAI,GACrBG,IAAIC,SAAS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