@flowscripter/dynamic-cli-framework 1.7.3 → 1.7.4
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/cli-plugin.ts +1 -1
- package/dist/cli-plugin.d.ts +1 -1
- package/dist/cli-plugin.d.ts.map +1 -1
- package/dist/cli-plugin.js +25 -247
- package/dist/index.js +70 -105754
- package/dist/src/api/BaseCLIFeatureOptions.js +0 -0
- package/dist/src/api/CLI.js +0 -0
- package/dist/src/api/CLIConfig.js +0 -0
- package/dist/src/api/Context.js +0 -0
- package/dist/src/api/RunResult.js +73 -0
- package/dist/src/api/argument/Argument.js +0 -0
- package/dist/src/api/argument/ArgumentValueTypes.js +18 -0
- package/dist/src/api/argument/ComplexOption.js +1 -0
- package/dist/src/api/argument/GlobalCommandArgument.js +0 -0
- package/dist/src/api/argument/Option.js +0 -0
- package/dist/src/api/argument/Positional.js +0 -0
- package/dist/src/api/argument/SubCommandArgument.js +1 -0
- package/dist/src/api/command/Command.js +0 -0
- package/dist/src/api/command/GlobalCommand.js +0 -0
- package/dist/src/api/command/GlobalModifierCommand.js +0 -0
- package/dist/src/api/command/GroupCommand.js +0 -0
- package/dist/src/api/command/SubCommand.js +0 -0
- package/dist/src/api/command/UsageExample.js +0 -0
- package/dist/src/api/plugin/CLIPlugin.js +2 -0
- package/dist/src/api/plugin/CommandFactory.js +7 -0
- package/dist/src/api/plugin/ServiceProviderFactory.js +7 -0
- package/dist/src/api/plugin/createCLIPlugin.js +30 -0
- package/dist/src/api/service/ServiceProvider.js +0 -0
- package/dist/src/api/service/core/ArgumentPrompterService.js +1 -0
- package/dist/src/api/service/core/AsciiBannerGeneratorService.js +1 -0
- package/dist/src/api/service/core/CompletionService.js +8 -0
- package/dist/src/api/service/core/DataDumpGeneratorService.js +7 -0
- package/dist/src/api/service/core/ImagePrinterService.js +1 -0
- package/dist/src/api/service/core/KeyValueService.js +7 -0
- package/dist/src/api/service/core/PluginService.js +6 -0
- package/dist/src/api/service/core/PrettyPrinterService.js +1 -0
- package/dist/src/api/service/core/PrinterService.js +42 -0
- package/dist/src/api/service/core/PrompterService.js +10 -0
- package/dist/src/api/service/core/SecretService.js +0 -0
- package/dist/src/api/service/core/ShutdownService.js +1 -0
- package/dist/src/api/service/core/SyntaxHighlighterService.js +1 -0
- package/dist/src/api/service/core/Table.js +49 -0
- package/dist/src/api/service/core/TableGeneratorService.d.ts +1 -0
- package/dist/src/api/service/core/TableGeneratorService.d.ts.map +1 -1
- package/dist/src/api/service/core/TableGeneratorService.js +7 -0
- package/dist/src/api/service/core/TreePrinterService.js +1 -0
- package/dist/src/cli/BaseCLI.d.ts.map +1 -1
- package/dist/src/cli/BaseCLI.js +233 -0
- package/dist/src/cli/DefaultRuntimeCLI.js +20 -0
- package/dist/src/cli/DynamicPluginRuntimeCLI.js +50 -0
- package/dist/src/command/MultiCommandCliHelpCommand.js +238 -0
- package/dist/src/command/SingleCommandCliHelpCommand.js +104 -0
- package/dist/src/command/UsageCommand.js +16 -0
- package/dist/src/command/VersionCommand.js +13 -0
- package/dist/src/launcher.js +61 -0
- package/dist/src/runtime/DefaultContext.js +25 -0
- package/dist/src/runtime/argument/ArgumentTypeGuards.js +3 -0
- package/dist/src/runtime/command/CommandTypeGuards.js +12 -0
- package/dist/src/runtime/command/CommandValidator.js +371 -0
- package/dist/src/runtime/parser.js +105 -0
- package/dist/src/runtime/registry/CommandRegistry.js +0 -0
- package/dist/src/runtime/registry/DefaultCommandRegistry.js +190 -0
- package/dist/src/runtime/registry/DefaultServiceProviderRegistry.js +20 -0
- package/dist/src/runtime/registry/ServiceProviderRegistry.js +0 -0
- package/dist/src/runtime/runner.js +507 -0
- package/dist/src/runtime/scanner.js +244 -0
- package/dist/src/runtime/values/ValuePopulationResult.js +0 -0
- package/dist/src/runtime/values/argumentValueMerge.js +122 -0
- package/dist/src/runtime/values/argumentValueValidation.js +505 -0
- package/dist/src/runtime/values/globalCommandValuePopulation.js +67 -0
- package/dist/src/runtime/values/subCommandValuePopulation.js +549 -0
- package/dist/src/service/argumentPrompter/ArgumentPrompterServiceProvider.js +19 -0
- package/dist/src/service/argumentPrompter/DefaultArgumentPrompterService.js +197 -0
- package/dist/src/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.js +28 -0
- package/dist/src/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.js +233 -0
- package/dist/src/service/asciiBannerGenerator/standard.flf.json +3 -0
- package/dist/src/service/banner/BannerServiceProvider.js +60 -0
- package/dist/src/service/banner/command/NoBannerCommand.js +24 -0
- package/dist/src/service/chiselAsciiBannerGenerator/ChiselFontAsciiBannerGeneratorService.js +51 -0
- package/dist/src/service/chiselAsciiBannerGenerator/chisel.flf.json +3 -0
- package/dist/src/service/completion/CompletionServiceProvider.d.ts +2 -1
- package/dist/src/service/completion/CompletionServiceProvider.d.ts.map +1 -1
- package/dist/src/service/completion/CompletionServiceProvider.js +160 -0
- package/dist/src/service/completion/DefaultCompletionService.js +279 -0
- package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts +15 -0
- package/dist/src/service/completion/command/CompletionCompleteSubCommand.d.ts.map +1 -0
- package/dist/src/service/completion/command/CompletionCompleteSubCommand.js +37 -0
- package/dist/src/service/completion/command/CompletionGroupCommand.d.ts +14 -0
- package/dist/src/service/completion/command/CompletionGroupCommand.d.ts.map +1 -0
- package/dist/src/service/completion/command/CompletionGroupCommand.js +10 -0
- package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts +14 -0
- package/dist/src/service/completion/command/CompletionIntegrationSubCommand.d.ts.map +1 -0
- package/dist/src/service/completion/command/CompletionIntegrationSubCommand.js +67 -0
- package/dist/src/service/completion/shell/ShellHandler.js +0 -0
- package/dist/src/service/completion/shell/bash.js +39 -0
- package/dist/src/service/completion/shell/fish.js +35 -0
- package/dist/src/service/completion/shell/powershell.js +51 -0
- package/dist/src/service/completion/shell/zsh.js +42 -0
- package/dist/src/service/configuration/ConfigurationServiceProvider.js +482 -0
- package/dist/src/service/configuration/DefaultKeyValueService.js +80 -0
- package/dist/src/service/configuration/DefaultSecretService.js +60 -0
- package/dist/src/service/configuration/command/ConfigCommand.js +24 -0
- package/dist/src/service/configuration/command/DumpConfigCommand.js +18 -0
- package/dist/src/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.js +24 -0
- package/dist/src/service/dataDumpGenerator/DefaultDataDumpGeneratorService.js +59 -0
- package/dist/src/service/imagePrinter/DefaultImagePrinterService.js +10 -0
- package/dist/src/service/imagePrinter/ImagePrinterServiceProvider.js +20 -0
- package/dist/src/service/plugin/DefaultPluginService.js +21 -0
- package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts +1 -1
- package/dist/src/service/plugin/DefaultPluginServiceProvider.d.ts.map +1 -1
- package/dist/src/service/plugin/DefaultPluginServiceProvider.js +21 -0
- package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts +17 -0
- package/dist/src/service/plugin/command/PluginAddSubCommand.d.ts.map +1 -0
- package/dist/src/service/plugin/command/PluginAddSubCommand.js +49 -0
- package/dist/src/service/plugin/command/PluginGroupCommand.d.ts +12 -0
- package/dist/src/service/plugin/command/PluginGroupCommand.d.ts.map +1 -0
- package/dist/src/service/plugin/command/PluginGroupCommand.js +21 -0
- package/dist/src/service/plugin/command/PluginListSubCommand.d.ts +12 -0
- package/dist/src/service/plugin/command/PluginListSubCommand.d.ts.map +1 -0
- package/dist/src/service/plugin/command/PluginListSubCommand.js +25 -0
- package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts +17 -0
- package/dist/src/service/plugin/command/PluginRemoveSubCommand.d.ts.map +1 -0
- package/dist/src/service/plugin/command/PluginRemoveSubCommand.js +24 -0
- package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts +18 -0
- package/dist/src/service/plugin/command/PluginSearchSubCommand.d.ts.map +1 -0
- package/dist/src/service/plugin/command/PluginSearchSubCommand.js +34 -0
- package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts +12 -0
- package/dist/src/service/plugin/command/PluginUpgradeSubCommand.d.ts.map +1 -0
- package/dist/src/service/plugin/command/PluginUpgradeSubCommand.js +25 -0
- package/dist/src/service/plugin/command/getPluginId.d.ts +3 -0
- package/dist/src/service/plugin/command/getPluginId.d.ts.map +1 -0
- package/dist/src/service/plugin/command/getPluginId.js +3 -0
- package/dist/src/service/prettyPrinter/DefaultPrettyPrinterService.js +45 -0
- package/dist/src/service/prettyPrinter/PrettyPrinterServiceProvider.js +28 -0
- package/dist/src/service/printer/DefaultPrinterService.js +250 -0
- package/dist/src/service/printer/PrinterServiceProvider.js +43 -0
- package/dist/src/service/printer/command/DarkModeCommand.js +24 -0
- package/dist/src/service/printer/command/LogLevelCommand.js +41 -0
- package/dist/src/service/printer/command/NoColorCommand.js +24 -0
- package/dist/src/service/printer/command/NoHyperlinksCommand.js +21 -0
- package/dist/src/service/printer/terminal/Color.js +15 -0
- package/dist/src/service/printer/terminal/Progress.js +271 -0
- package/dist/src/service/printer/terminal/Spinner.js +83 -0
- package/dist/src/service/printer/terminal/Theme.js +26 -0
- package/dist/src/service/prompter/DefaultPrompterService.js +52 -0
- package/dist/src/service/prompter/PrompterServiceProvider.js +20 -0
- package/dist/src/service/prompter/command/NoPromptCommand.js +21 -0
- package/dist/src/service/prompter/prompt/PromptContext.js +22 -0
- package/dist/src/service/prompter/prompt/promptAcknowledge.js +19 -0
- package/dist/src/service/prompter/prompt/promptMultiSelect.js +74 -0
- package/dist/src/service/prompter/prompt/promptOpenUrl.js +70 -0
- package/dist/src/service/prompter/prompt/promptSingleSelect.js +73 -0
- package/dist/src/service/prompter/prompt/promptText.js +75 -0
- package/dist/src/service/prompter/prompt/promptToggle.js +21 -0
- package/dist/src/service/shutdown/DefaultShutdownService.js +16 -0
- package/dist/src/service/shutdown/ShutdownServiceProvider.js +60 -0
- package/dist/src/service/shutdown/ShutdownState.js +5 -0
- package/dist/src/service/syntaxHighlighter/DefaultSyntaxHighlighterService.js +54 -0
- package/dist/src/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.js +32 -0
- package/dist/src/service/tableGenerator/DefaultTableGeneratorService.d.ts +3 -1
- package/dist/src/service/tableGenerator/DefaultTableGeneratorService.d.ts.map +1 -1
- package/dist/src/service/tableGenerator/DefaultTableGeneratorService.js +344 -0
- package/dist/src/service/tableGenerator/TableGeneratorServiceProvider.js +26 -0
- package/dist/src/service/treePrinter/DefaultTreePrinterService.js +35 -0
- package/dist/src/service/treePrinter/TreePrinterServiceProvider.js +24 -0
- package/dist/src/terminal/Ansi.js +23 -0
- package/dist/src/terminal/ImageRenderer.js +164 -0
- package/dist/src/terminal/KeyReader.js +13 -0
- package/dist/src/terminal/PngDecoder.js +115 -0
- package/dist/src/terminal/Styler.js +0 -0
- package/dist/src/terminal/Terminal.js +0 -0
- package/dist/src/terminal/TtyKeyReader.js +87 -0
- package/dist/src/terminal/TtyStyler.js +55 -0
- package/dist/src/terminal/TtyTerminal.js +52 -0
- package/dist/src/terminal/supportsHyperlinks.js +95 -0
- package/dist/src/util/configHelper.js +61 -0
- package/dist/src/util/envVarHelper.js +216 -0
- package/dist/src/util/helpHelper.d.ts.map +1 -1
- package/dist/src/util/helpHelper.js +497 -0
- package/dist/src/util/logger.js +81 -0
- package/dist/src/util/runnerHelper.js +80 -0
- package/package.json +2 -2
- package/src/api/service/core/TableGeneratorService.ts +1 -0
- package/src/cli/BaseCLI.ts +4 -18
- package/src/service/completion/CompletionServiceProvider.ts +16 -2
- package/src/service/completion/command/CompletionCompleteSubCommand.ts +59 -0
- package/src/service/completion/command/CompletionGroupCommand.ts +21 -0
- package/src/{command/CompletionCommand.ts → service/completion/command/CompletionIntegrationSubCommand.ts} +12 -73
- package/src/service/completion/shell/bash.ts +1 -1
- package/src/service/completion/shell/fish.ts +1 -1
- package/src/service/completion/shell/powershell.ts +1 -1
- package/src/service/completion/shell/zsh.ts +1 -1
- package/src/service/plugin/DefaultPluginServiceProvider.ts +2 -2
- package/src/service/plugin/command/PluginAddSubCommand.ts +64 -0
- package/src/service/plugin/command/PluginGroupCommand.ts +27 -0
- package/src/service/plugin/command/PluginListSubCommand.ts +33 -0
- package/src/service/plugin/command/PluginRemoveSubCommand.ts +32 -0
- package/src/service/plugin/command/PluginSearchSubCommand.ts +42 -0
- package/src/service/plugin/command/PluginUpgradeSubCommand.ts +36 -0
- package/src/service/plugin/command/getPluginId.ts +5 -0
- package/src/service/tableGenerator/DefaultTableGeneratorService.ts +6 -1
- package/src/util/helpHelper.ts +1 -2
- package/dist/src/command/CompletionCommand.d.ts +0 -32
- package/dist/src/command/CompletionCommand.d.ts.map +0 -1
- package/dist/src/command/PluginCommand.d.ts +0 -67
- package/dist/src/command/PluginCommand.d.ts.map +0 -1
- package/dist/tests/cli/BaseCLI.test.d.ts +0 -2
- package/dist/tests/cli/BaseCLI.test.d.ts.map +0 -1
- package/dist/tests/cli/DynamicPluginRuntimeCLI.test.d.ts +0 -2
- package/dist/tests/cli/DynamicPluginRuntimeCLI.test.d.ts.map +0 -1
- package/dist/tests/command/CompletionCommand.test.d.ts +0 -2
- package/dist/tests/command/CompletionCommand.test.d.ts.map +0 -1
- package/dist/tests/command/MultiCommandCliHelpCommand.test.d.ts +0 -2
- package/dist/tests/command/MultiCommandCliHelpCommand.test.d.ts.map +0 -1
- package/dist/tests/command/PluginCommand.test.d.ts +0 -2
- package/dist/tests/command/PluginCommand.test.d.ts.map +0 -1
- package/dist/tests/command/SingleCommandCliHelpCommand.test.d.ts +0 -2
- package/dist/tests/command/SingleCommandCliHelpCommand.test.d.ts.map +0 -1
- package/dist/tests/command/UsageCommand.test.d.ts +0 -2
- package/dist/tests/command/UsageCommand.test.d.ts.map +0 -1
- package/dist/tests/command/VersionCommand.test.d.ts +0 -2
- package/dist/tests/command/VersionCommand.test.d.ts.map +0 -1
- package/dist/tests/fixtures/CLIConfig.d.ts +0 -3
- package/dist/tests/fixtures/CLIConfig.d.ts.map +0 -1
- package/dist/tests/fixtures/Command.d.ts +0 -20
- package/dist/tests/fixtures/Command.d.ts.map +0 -1
- package/dist/tests/fixtures/CommandRegistry.d.ts +0 -4
- package/dist/tests/fixtures/CommandRegistry.d.ts.map +0 -1
- package/dist/tests/fixtures/ConfigurationServiceProvider.d.ts +0 -10
- package/dist/tests/fixtures/ConfigurationServiceProvider.d.ts.map +0 -1
- package/dist/tests/fixtures/Context.d.ts +0 -4
- package/dist/tests/fixtures/Context.d.ts.map +0 -1
- package/dist/tests/fixtures/ServiceProviderRegistry.d.ts +0 -4
- package/dist/tests/fixtures/ServiceProviderRegistry.d.ts.map +0 -1
- package/dist/tests/fixtures/StreamString.d.ts +0 -10
- package/dist/tests/fixtures/StreamString.d.ts.map +0 -1
- package/dist/tests/fixtures/prettierPluginFoo.d.ts +0 -4
- package/dist/tests/fixtures/prettierPluginFoo.d.ts.map +0 -1
- package/dist/tests/fixtures/util.d.ts +0 -8
- package/dist/tests/fixtures/util.d.ts.map +0 -1
- package/dist/tests/runtime/DefaultContext.test.d.ts +0 -2
- package/dist/tests/runtime/DefaultContext.test.d.ts.map +0 -1
- package/dist/tests/runtime/argument/ArgumentTypeGuards.test.d.ts +0 -2
- package/dist/tests/runtime/argument/ArgumentTypeGuards.test.d.ts.map +0 -1
- package/dist/tests/runtime/command/CommandTypeGuards.test.d.ts +0 -2
- package/dist/tests/runtime/command/CommandTypeGuards.test.d.ts.map +0 -1
- package/dist/tests/runtime/command/CommandValidator.test.d.ts +0 -2
- package/dist/tests/runtime/command/CommandValidator.test.d.ts.map +0 -1
- package/dist/tests/runtime/parser.test.d.ts +0 -2
- package/dist/tests/runtime/parser.test.d.ts.map +0 -1
- package/dist/tests/runtime/registry/DefaultCommandRegistry.test.d.ts +0 -2
- package/dist/tests/runtime/registry/DefaultCommandRegistry.test.d.ts.map +0 -1
- package/dist/tests/runtime/registry/DefaultServiceProviderRegistry.test.d.ts +0 -2
- package/dist/tests/runtime/registry/DefaultServiceProviderRegistry.test.d.ts.map +0 -1
- package/dist/tests/runtime/runner.test.d.ts +0 -2
- package/dist/tests/runtime/runner.test.d.ts.map +0 -1
- package/dist/tests/runtime/scanner.test.d.ts +0 -2
- package/dist/tests/runtime/scanner.test.d.ts.map +0 -1
- package/dist/tests/runtime/values/argumentValueMerge.test.d.ts +0 -2
- package/dist/tests/runtime/values/argumentValueMerge.test.d.ts.map +0 -1
- package/dist/tests/runtime/values/argumentValueValidation.test.d.ts +0 -2
- package/dist/tests/runtime/values/argumentValueValidation.test.d.ts.map +0 -1
- package/dist/tests/runtime/values/globalCommandValuePopulation.test.d.ts +0 -2
- package/dist/tests/runtime/values/globalCommandValuePopulation.test.d.ts.map +0 -1
- package/dist/tests/runtime/values/subCommandValuePopulation.test.d.ts +0 -2
- package/dist/tests/runtime/values/subCommandValuePopulation.test.d.ts.map +0 -1
- package/dist/tests/service/argumentPrompter/ArgumentPrompterServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/argumentPrompter/ArgumentPrompterServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/argumentPrompter/DefaultArgumentPrompterService.test.d.ts +0 -2
- package/dist/tests/service/argumentPrompter/DefaultArgumentPrompterService.test.d.ts.map +0 -1
- package/dist/tests/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/asciiBannerGenerator/AsciiBannerGeneratorServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.test.d.ts +0 -2
- package/dist/tests/service/asciiBannerGenerator/DefaultAsciiBannerGeneratorService.test.d.ts.map +0 -1
- package/dist/tests/service/banner/BannerServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/banner/BannerServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/banner/command/NoBannerCommand.test.d.ts +0 -2
- package/dist/tests/service/banner/command/NoBannerCommand.test.d.ts.map +0 -1
- package/dist/tests/service/chiselAsciiBannerGenerator/ChiselFontAsciiBannerGeneratorService.test.d.ts +0 -2
- package/dist/tests/service/chiselAsciiBannerGenerator/ChiselFontAsciiBannerGeneratorService.test.d.ts.map +0 -1
- package/dist/tests/service/completion/CompletionServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/completion/CompletionServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/completion/DefaultCompletionService.test.d.ts +0 -2
- package/dist/tests/service/completion/DefaultCompletionService.test.d.ts.map +0 -1
- package/dist/tests/service/completion/shell/bash.test.d.ts +0 -2
- package/dist/tests/service/completion/shell/bash.test.d.ts.map +0 -1
- package/dist/tests/service/completion/shell/fish.test.d.ts +0 -2
- package/dist/tests/service/completion/shell/fish.test.d.ts.map +0 -1
- package/dist/tests/service/completion/shell/powershell.test.d.ts +0 -2
- package/dist/tests/service/completion/shell/powershell.test.d.ts.map +0 -1
- package/dist/tests/service/completion/shell/zsh.test.d.ts +0 -2
- package/dist/tests/service/completion/shell/zsh.test.d.ts.map +0 -1
- package/dist/tests/service/configuration/ConfigurationServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/configuration/ConfigurationServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/configuration/DefaultKeyValueService.test.d.ts +0 -2
- package/dist/tests/service/configuration/DefaultKeyValueService.test.d.ts.map +0 -1
- package/dist/tests/service/configuration/DefaultSecretService.test.d.ts +0 -2
- package/dist/tests/service/configuration/DefaultSecretService.test.d.ts.map +0 -1
- package/dist/tests/service/configuration/command/ConfigCommand.test.d.ts +0 -2
- package/dist/tests/service/configuration/command/ConfigCommand.test.d.ts.map +0 -1
- package/dist/tests/service/configuration/command/DumpConfigCommand.test.d.ts +0 -2
- package/dist/tests/service/configuration/command/DumpConfigCommand.test.d.ts.map +0 -1
- package/dist/tests/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/dataDumpGenerator/DataDumpGeneratorServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/dataDumpGenerator/DefaultDataDumpGeneratorService.test.d.ts +0 -2
- package/dist/tests/service/dataDumpGenerator/DefaultDataDumpGeneratorService.test.d.ts.map +0 -1
- package/dist/tests/service/imagePrinter/DefaultImagePrinterService.test.d.ts +0 -2
- package/dist/tests/service/imagePrinter/DefaultImagePrinterService.test.d.ts.map +0 -1
- package/dist/tests/service/imagePrinter/ImagePrinterServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/imagePrinter/ImagePrinterServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/plugin/DefaultPluginServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/plugin/DefaultPluginServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/prettyPrinter/DefaultPrettyPrinterService.test.d.ts +0 -2
- package/dist/tests/service/prettyPrinter/DefaultPrettyPrinterService.test.d.ts.map +0 -1
- package/dist/tests/service/prettyPrinter/PrettyPrinterServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/prettyPrinter/PrettyPrinterServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/printer/DefaultPrinterService.test.d.ts +0 -2
- package/dist/tests/service/printer/DefaultPrinterService.test.d.ts.map +0 -1
- package/dist/tests/service/printer/PrinterServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/printer/PrinterServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/printer/command/DarkModeCommand.test.d.ts +0 -2
- package/dist/tests/service/printer/command/DarkModeCommand.test.d.ts.map +0 -1
- package/dist/tests/service/printer/command/LogLevelCommand.test.d.ts +0 -2
- package/dist/tests/service/printer/command/LogLevelCommand.test.d.ts.map +0 -1
- package/dist/tests/service/printer/command/NoColorCommand.test.d.ts +0 -2
- package/dist/tests/service/printer/command/NoColorCommand.test.d.ts.map +0 -1
- package/dist/tests/service/printer/command/NoHyperlinksCommand.test.d.ts +0 -2
- package/dist/tests/service/printer/command/NoHyperlinksCommand.test.d.ts.map +0 -1
- package/dist/tests/service/printer/terminal/Progress.test.d.ts +0 -2
- package/dist/tests/service/printer/terminal/Progress.test.d.ts.map +0 -1
- package/dist/tests/service/printer/terminal/Spinner.test.d.ts +0 -2
- package/dist/tests/service/printer/terminal/Spinner.test.d.ts.map +0 -1
- package/dist/tests/service/prompter/DefaultPrompterService.test.d.ts +0 -2
- package/dist/tests/service/prompter/DefaultPrompterService.test.d.ts.map +0 -1
- package/dist/tests/service/prompter/PrompterServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/prompter/PrompterServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/prompter/command/NoPromptCommand.test.d.ts +0 -2
- package/dist/tests/service/prompter/command/NoPromptCommand.test.d.ts.map +0 -1
- package/dist/tests/service/prompter/prompt/PromptContext.test.d.ts +0 -2
- package/dist/tests/service/prompter/prompt/PromptContext.test.d.ts.map +0 -1
- package/dist/tests/service/shutdown/ShutdownServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/shutdown/ShutdownServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/syntaxHighlighter/DefaultSyntaxHighlighterService.test.d.ts +0 -2
- package/dist/tests/service/syntaxHighlighter/DefaultSyntaxHighlighterService.test.d.ts.map +0 -1
- package/dist/tests/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/syntaxHighlighter/SyntaxHighlighterServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/tableGenerator/DefaultTableGeneratorService.test.d.ts +0 -2
- package/dist/tests/service/tableGenerator/DefaultTableGeneratorService.test.d.ts.map +0 -1
- package/dist/tests/service/tableGenerator/TableGeneratorServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/tableGenerator/TableGeneratorServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/service/treePrinter/DefaultTreePrinterService.test.d.ts +0 -2
- package/dist/tests/service/treePrinter/DefaultTreePrinterService.test.d.ts.map +0 -1
- package/dist/tests/service/treePrinter/TreePrinterServiceProvider.test.d.ts +0 -2
- package/dist/tests/service/treePrinter/TreePrinterServiceProvider.test.d.ts.map +0 -1
- package/dist/tests/terminal/ImageRenderer.test.d.ts +0 -2
- package/dist/tests/terminal/ImageRenderer.test.d.ts.map +0 -1
- package/dist/tests/terminal/PngDecoder.test.d.ts +0 -2
- package/dist/tests/terminal/PngDecoder.test.d.ts.map +0 -1
- package/dist/tests/terminal/supportsHyperlinks.test.d.ts +0 -2
- package/dist/tests/terminal/supportsHyperlinks.test.d.ts.map +0 -1
- package/dist/tests/util/configHelper.test.d.ts +0 -2
- package/dist/tests/util/configHelper.test.d.ts.map +0 -1
- package/dist/tests/util/envVarHelper.test.d.ts +0 -2
- package/dist/tests/util/envVarHelper.test.d.ts.map +0 -1
- package/dist/tests/util/logger.test.d.ts +0 -2
- package/dist/tests/util/logger.test.d.ts.map +0 -1
- package/src/command/PluginCommand.ts +0 -197
package/src/cli/BaseCLI.ts
CHANGED
|
@@ -51,11 +51,6 @@ import ArgumentPrompterServiceProvider from "../service/argumentPrompter/Argumen
|
|
|
51
51
|
import DefaultCompletionService from "../service/completion/DefaultCompletionService.ts";
|
|
52
52
|
import CompletionServiceProvider from "../service/completion/CompletionServiceProvider.ts";
|
|
53
53
|
import ImagePrinterServiceProvider from "../service/imagePrinter/ImagePrinterServiceProvider.ts";
|
|
54
|
-
import {
|
|
55
|
-
CompletionCompleteSubCommand,
|
|
56
|
-
CompletionGroupCommand,
|
|
57
|
-
CompletionIntegrationSubCommand,
|
|
58
|
-
} from "../command/CompletionCommand.ts";
|
|
59
54
|
const logger = getLogger("BaseCLI");
|
|
60
55
|
|
|
61
56
|
/**
|
|
@@ -233,10 +228,11 @@ export default class BaseCLI implements CLI {
|
|
|
233
228
|
this.addServiceProvider(new ImagePrinterServiceProvider(55, this.#stdoutTerminal));
|
|
234
229
|
}
|
|
235
230
|
|
|
236
|
-
let completionService: DefaultCompletionService | undefined;
|
|
237
231
|
if (this.#options.completionServiceEnabled) {
|
|
238
|
-
completionService = new DefaultCompletionService();
|
|
239
|
-
this.addServiceProvider(
|
|
232
|
+
const completionService = new DefaultCompletionService();
|
|
233
|
+
this.addServiceProvider(
|
|
234
|
+
new CompletionServiceProvider(5, completionService, this.#commandRegistry),
|
|
235
|
+
);
|
|
240
236
|
}
|
|
241
237
|
|
|
242
238
|
const configurationServiceProvider = new ConfigurationServiceProvider(
|
|
@@ -303,16 +299,6 @@ export default class BaseCLI implements CLI {
|
|
|
303
299
|
// register the version command
|
|
304
300
|
this.#commandRegistry.addCommand(new VersionCommand());
|
|
305
301
|
|
|
306
|
-
// register completion commands (need CommandRegistry reference like help commands)
|
|
307
|
-
if (completionService) {
|
|
308
|
-
completionService.setCommandRegistry(this.#commandRegistry);
|
|
309
|
-
const integrationCommand = new CompletionIntegrationSubCommand();
|
|
310
|
-
const completeCommand = new CompletionCompleteSubCommand();
|
|
311
|
-
this.#commandRegistry.addCommand(
|
|
312
|
-
new CompletionGroupCommand(integrationCommand, completeCommand),
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
302
|
// run...
|
|
317
303
|
const runResult = await run(
|
|
318
304
|
args,
|
|
@@ -13,7 +13,11 @@ import { KEY_VALUE_SERVICE_ID } from "../../api/service/core/KeyValueService.ts"
|
|
|
13
13
|
import type KeyValueService from "../../api/service/core/KeyValueService.ts";
|
|
14
14
|
import { Icon, PRINTER_SERVICE_ID } from "../../api/service/core/PrinterService.ts";
|
|
15
15
|
import type PrinterService from "../../api/service/core/PrinterService.ts";
|
|
16
|
+
import type CommandRegistry from "../../runtime/registry/CommandRegistry.ts";
|
|
16
17
|
import getLogger from "../../util/logger.ts";
|
|
18
|
+
import { CompletionIntegrationSubCommand } from "./command/CompletionIntegrationSubCommand.ts";
|
|
19
|
+
import { CompletionCompleteSubCommand } from "./command/CompletionCompleteSubCommand.ts";
|
|
20
|
+
import { CompletionGroupCommand } from "./command/CompletionGroupCommand.ts";
|
|
17
21
|
|
|
18
22
|
const logger = getLogger("CompletionServiceProvider");
|
|
19
23
|
|
|
@@ -23,16 +27,26 @@ export default class CompletionServiceProvider implements ServiceProvider {
|
|
|
23
27
|
readonly #completionService: DefaultCompletionService;
|
|
24
28
|
#cliName = "";
|
|
25
29
|
|
|
26
|
-
public constructor(
|
|
30
|
+
public constructor(
|
|
31
|
+
servicePriority: number,
|
|
32
|
+
completionService: DefaultCompletionService,
|
|
33
|
+
commandRegistry: CommandRegistry,
|
|
34
|
+
) {
|
|
27
35
|
this.servicePriority = servicePriority;
|
|
28
36
|
this.#completionService = completionService;
|
|
37
|
+
this.#completionService.setCommandRegistry(commandRegistry);
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
public getServiceInfo(cliConfig: CLIConfig): Promise<ServiceInfo> {
|
|
32
41
|
this.#cliName = cliConfig.name;
|
|
33
42
|
return Promise.resolve({
|
|
34
43
|
service: this.#completionService,
|
|
35
|
-
commands: [
|
|
44
|
+
commands: [
|
|
45
|
+
new CompletionGroupCommand(
|
|
46
|
+
new CompletionIntegrationSubCommand(),
|
|
47
|
+
new CompletionCompleteSubCommand(),
|
|
48
|
+
),
|
|
49
|
+
],
|
|
36
50
|
});
|
|
37
51
|
}
|
|
38
52
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
2
|
+
import type Option from "../../../api/argument/Option.ts";
|
|
3
|
+
import type Positional from "../../../api/argument/Positional.ts";
|
|
4
|
+
import type Context from "../../../api/Context.ts";
|
|
5
|
+
import {
|
|
6
|
+
type ArgumentValues,
|
|
7
|
+
ArgumentValueTypeName,
|
|
8
|
+
} from "../../../api/argument/ArgumentValueTypes.ts";
|
|
9
|
+
import { COMPLETION_SERVICE_ID, ShellType } from "../../../api/service/core/CompletionService.ts";
|
|
10
|
+
import type DefaultCompletionService from "../DefaultCompletionService.ts";
|
|
11
|
+
import { PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
|
|
12
|
+
import type PrinterService from "../../../api/service/core/PrinterService.ts";
|
|
13
|
+
|
|
14
|
+
export class CompletionCompleteSubCommand implements SubCommand {
|
|
15
|
+
readonly name = "complete";
|
|
16
|
+
readonly description = "Generate completions for shell integration";
|
|
17
|
+
readonly enableConfiguration = false;
|
|
18
|
+
readonly disableGenericHelpDisplay = true;
|
|
19
|
+
|
|
20
|
+
readonly options: ReadonlyArray<Option> = [];
|
|
21
|
+
|
|
22
|
+
readonly positionals: ReadonlyArray<Positional> = [
|
|
23
|
+
{
|
|
24
|
+
name: "shell",
|
|
25
|
+
type: ArgumentValueTypeName.STRING,
|
|
26
|
+
allowableValues: Object.values(ShellType),
|
|
27
|
+
description: "Shell type",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "args",
|
|
31
|
+
type: ArgumentValueTypeName.STRING,
|
|
32
|
+
isVarargMultiple: true,
|
|
33
|
+
isVarargOptional: true,
|
|
34
|
+
description: "Shell-specific completion context arguments",
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
|
|
39
|
+
const completionService = context.getServiceById(
|
|
40
|
+
COMPLETION_SERVICE_ID,
|
|
41
|
+
) as DefaultCompletionService;
|
|
42
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
43
|
+
|
|
44
|
+
const shellType = argumentValues.shell as ShellType;
|
|
45
|
+
const args = (argumentValues.args || []) as string[];
|
|
46
|
+
|
|
47
|
+
const completionContext = completionService.parseCompletionContext(shellType, args);
|
|
48
|
+
const completions = await completionService.generateCompletions(
|
|
49
|
+
shellType,
|
|
50
|
+
completionContext.line,
|
|
51
|
+
completionContext.cursorPosition,
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const output = completionService.formatCompletions(shellType, completions);
|
|
55
|
+
if (output.length > 0) {
|
|
56
|
+
await printerService.print(output + "\n");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type GroupCommand from "../../../api/command/GroupCommand.ts";
|
|
2
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
3
|
+
import type Context from "../../../api/Context.ts";
|
|
4
|
+
import type { CompletionIntegrationSubCommand } from "./CompletionIntegrationSubCommand.ts";
|
|
5
|
+
import type { CompletionCompleteSubCommand } from "./CompletionCompleteSubCommand.ts";
|
|
6
|
+
|
|
7
|
+
export class CompletionGroupCommand implements GroupCommand {
|
|
8
|
+
readonly name = "completion";
|
|
9
|
+
readonly description = "Manage shell auto-completion";
|
|
10
|
+
readonly enableConfiguration = false;
|
|
11
|
+
readonly memberSubCommands: ReadonlyArray<SubCommand>;
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
integrationCommand: CompletionIntegrationSubCommand,
|
|
15
|
+
completeCommand: CompletionCompleteSubCommand,
|
|
16
|
+
) {
|
|
17
|
+
this.memberSubCommands = [integrationCommand, completeCommand];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async execute(_context: Context): Promise<void> {}
|
|
21
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
5
|
-
import type
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import type
|
|
2
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
3
|
+
import type Option from "../../../api/argument/Option.ts";
|
|
4
|
+
import type Positional from "../../../api/argument/Positional.ts";
|
|
5
|
+
import type Context from "../../../api/Context.ts";
|
|
6
|
+
import {
|
|
7
|
+
type ArgumentValues,
|
|
8
|
+
ArgumentValueTypeName,
|
|
9
|
+
} from "../../../api/argument/ArgumentValueTypes.ts";
|
|
10
|
+
import { COMPLETION_SERVICE_ID, ShellType } from "../../../api/service/core/CompletionService.ts";
|
|
11
|
+
import type DefaultCompletionService from "../DefaultCompletionService.ts";
|
|
12
|
+
import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
|
|
13
|
+
import type PrinterService from "../../../api/service/core/PrinterService.ts";
|
|
12
14
|
|
|
13
15
|
export class CompletionIntegrationSubCommand implements SubCommand {
|
|
14
16
|
readonly name = "integration";
|
|
@@ -94,66 +96,3 @@ export class CompletionIntegrationSubCommand implements SubCommand {
|
|
|
94
96
|
);
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
export class CompletionCompleteSubCommand implements SubCommand {
|
|
99
|
-
readonly name = "complete";
|
|
100
|
-
readonly description = "Generate completions for shell integration";
|
|
101
|
-
readonly enableConfiguration = false;
|
|
102
|
-
readonly disableGenericHelpDisplay = true;
|
|
103
|
-
|
|
104
|
-
readonly options: ReadonlyArray<Option> = [];
|
|
105
|
-
|
|
106
|
-
readonly positionals: ReadonlyArray<Positional> = [
|
|
107
|
-
{
|
|
108
|
-
name: "shell",
|
|
109
|
-
type: ArgumentValueTypeName.STRING,
|
|
110
|
-
allowableValues: Object.values(ShellType),
|
|
111
|
-
description: "Shell type",
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: "args",
|
|
115
|
-
type: ArgumentValueTypeName.STRING,
|
|
116
|
-
isVarargMultiple: true,
|
|
117
|
-
isVarargOptional: true,
|
|
118
|
-
description: "Shell-specific completion context arguments",
|
|
119
|
-
},
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
|
|
123
|
-
const completionService = context.getServiceById(
|
|
124
|
-
COMPLETION_SERVICE_ID,
|
|
125
|
-
) as DefaultCompletionService;
|
|
126
|
-
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
127
|
-
|
|
128
|
-
const shellType = argumentValues.shell as ShellType;
|
|
129
|
-
const args = (argumentValues.args || []) as string[];
|
|
130
|
-
|
|
131
|
-
const completionContext = completionService.parseCompletionContext(shellType, args);
|
|
132
|
-
const completions = await completionService.generateCompletions(
|
|
133
|
-
shellType,
|
|
134
|
-
completionContext.line,
|
|
135
|
-
completionContext.cursorPosition,
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const output = completionService.formatCompletions(shellType, completions);
|
|
139
|
-
if (output.length > 0) {
|
|
140
|
-
await printerService.print(output + "\n");
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export class CompletionGroupCommand implements GroupCommand {
|
|
146
|
-
readonly name = "completions";
|
|
147
|
-
readonly description = "Manage shell auto-completion";
|
|
148
|
-
readonly enableConfiguration = false;
|
|
149
|
-
readonly memberSubCommands: ReadonlyArray<SubCommand>;
|
|
150
|
-
|
|
151
|
-
constructor(
|
|
152
|
-
integrationCommand: CompletionIntegrationSubCommand,
|
|
153
|
-
completeCommand: CompletionCompleteSubCommand,
|
|
154
|
-
) {
|
|
155
|
-
this.memberSubCommands = [integrationCommand, completeCommand];
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
async execute(_context: Context): Promise<void> {}
|
|
159
|
-
}
|
|
@@ -16,7 +16,7 @@ export default class BashShellHandler implements ShellHandler {
|
|
|
16
16
|
return [
|
|
17
17
|
`_${cliName}_completions() {`,
|
|
18
18
|
` local IFS=$'\\n'`,
|
|
19
|
-
` COMPREPLY=( $("${executablePath}"
|
|
19
|
+
` COMPREPLY=( $("${executablePath}" completion:complete bash "\${COMP_LINE}" "\${COMP_POINT}" 2>/dev/null) )`,
|
|
20
20
|
`}`,
|
|
21
21
|
`complete -F _${cliName}_completions ${cliName}`,
|
|
22
22
|
].join("\n");
|
|
@@ -13,7 +13,7 @@ export default class FishShellHandler implements ShellHandler {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getBootstrapScript(cliName: string, executablePath: string): string {
|
|
16
|
-
return `complete -c ${cliName} -f -a '("${executablePath}"
|
|
16
|
+
return `complete -c ${cliName} -f -a '("${executablePath}" completion:complete fish (commandline -cp) (commandline -C) 2>/dev/null)'`;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
validateEnvironment(): Promise<boolean> {
|
|
@@ -19,7 +19,7 @@ export default class PowerShellShellHandler implements ShellHandler {
|
|
|
19
19
|
return [
|
|
20
20
|
`Register-ArgumentCompleter -Native -CommandName ${cliName} -ScriptBlock {`,
|
|
21
21
|
` param($wordToComplete, $commandAst, $cursorPosition)`,
|
|
22
|
-
` $completions = & "${executablePath}"
|
|
22
|
+
` $completions = & "${executablePath}" completion:complete powershell "$commandAst" "$cursorPosition" 2>$null`,
|
|
23
23
|
` $completions -split '\\n' | ForEach-Object {`,
|
|
24
24
|
` [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)`,
|
|
25
25
|
` }`,
|
|
@@ -16,7 +16,7 @@ export default class ZshShellHandler implements ShellHandler {
|
|
|
16
16
|
return [
|
|
17
17
|
`_${cliName}_completions() {`,
|
|
18
18
|
` local -a completions`,
|
|
19
|
-
` completions=("\${(@f)$("${executablePath}"
|
|
19
|
+
` completions=("\${(@f)$("${executablePath}" completion:complete zsh "\${words}" "\${CURSOR}" 2>/dev/null)}")`,
|
|
20
20
|
` _describe '${cliName}' completions`,
|
|
21
21
|
`}`,
|
|
22
22
|
`compdef _${cliName}_completions ${cliName}`,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceInfo, ServiceProvider } from "../../api/service/ServiceProvider.ts";
|
|
2
2
|
import type Context from "../../api/Context.ts";
|
|
3
3
|
import type CLIConfig from "../../api/CLIConfig.ts";
|
|
4
4
|
import type { MarketplacePluginManager } from "@flowscripter/dynamic-plugin-framework";
|
|
5
5
|
import { PLUGIN_SERVICE_ID } from "../../api/service/core/PluginService.ts";
|
|
6
6
|
import DefaultPluginService from "./DefaultPluginService.ts";
|
|
7
|
-
import { PluginGroupCommand } from "
|
|
7
|
+
import { PluginGroupCommand } from "./command/PluginGroupCommand.ts";
|
|
8
8
|
|
|
9
9
|
export default class DefaultPluginServiceProvider implements ServiceProvider {
|
|
10
10
|
readonly serviceId = PLUGIN_SERVICE_ID;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
2
|
+
import type Context from "../../../api/Context.ts";
|
|
3
|
+
import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
4
|
+
import { ArgumentValueTypeName } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
5
|
+
import type PrinterService from "../../../api/service/core/PrinterService.ts";
|
|
6
|
+
import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
|
|
7
|
+
import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
|
|
8
|
+
import type PluginService from "../../../api/service/core/PluginService.ts";
|
|
9
|
+
import type { VersionedPluginDescriptor } from "@flowscripter/dynamic-plugin-framework";
|
|
10
|
+
import { getPluginId } from "./getPluginId.ts";
|
|
11
|
+
|
|
12
|
+
export class PluginAddSubCommand implements SubCommand {
|
|
13
|
+
readonly name = "add";
|
|
14
|
+
readonly description = "Install a remote plugin";
|
|
15
|
+
readonly enableConfiguration = false;
|
|
16
|
+
readonly options = [];
|
|
17
|
+
readonly positionals = [
|
|
18
|
+
{
|
|
19
|
+
name: "pluginId",
|
|
20
|
+
description: "Plugin ID to install (e.g. @scope/name)",
|
|
21
|
+
type: ArgumentValueTypeName.STRING,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
|
|
26
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
27
|
+
const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
|
|
28
|
+
|
|
29
|
+
const pluginId = argumentValues["pluginId"] as string;
|
|
30
|
+
await printerService.info(`Searching for plugin: ${pluginId}\n`, Icon.INFORMATION);
|
|
31
|
+
|
|
32
|
+
let descriptor: VersionedPluginDescriptor | undefined;
|
|
33
|
+
for await (const d of pluginService.search({ text: pluginId })) {
|
|
34
|
+
if (getPluginId(d) === pluginId || d.pluginId === pluginId) {
|
|
35
|
+
descriptor = d;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!descriptor) {
|
|
41
|
+
// Search did not find an exact match - attempt direct install by plugin ID.
|
|
42
|
+
// This handles cases where the package exists on the registry but is not
|
|
43
|
+
// returned by search (e.g. recently published or low search ranking).
|
|
44
|
+
await printerService.info(
|
|
45
|
+
`Plugin not found via search, attempting direct install of ${pluginId}...\n`,
|
|
46
|
+
Icon.INFORMATION,
|
|
47
|
+
);
|
|
48
|
+
const parts = pluginId.startsWith("@") ? pluginId.slice(1).split("/") : [undefined, pluginId];
|
|
49
|
+
const scope = pluginId.startsWith("@") ? `@${parts[0]}` : undefined;
|
|
50
|
+
const name = pluginId.startsWith("@") ? parts[1]! : pluginId;
|
|
51
|
+
descriptor = {
|
|
52
|
+
pluginId,
|
|
53
|
+
scope,
|
|
54
|
+
name,
|
|
55
|
+
version: "latest",
|
|
56
|
+
extensionPoints: [],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
await printerService.info(`Installing ${descriptor.pluginId}...\n`, Icon.INFORMATION);
|
|
61
|
+
await pluginService.install(descriptor);
|
|
62
|
+
await printerService.print(`Plugin ${descriptor.pluginId} installed.\n`, Icon.SUCCESS);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type GroupCommand from "../../../api/command/GroupCommand.ts";
|
|
2
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
3
|
+
import type Context from "../../../api/Context.ts";
|
|
4
|
+
import { PluginListSubCommand } from "./PluginListSubCommand.ts";
|
|
5
|
+
import { PluginSearchSubCommand } from "./PluginSearchSubCommand.ts";
|
|
6
|
+
import { PluginAddSubCommand } from "./PluginAddSubCommand.ts";
|
|
7
|
+
import { PluginRemoveSubCommand } from "./PluginRemoveSubCommand.ts";
|
|
8
|
+
import { PluginUpgradeSubCommand } from "./PluginUpgradeSubCommand.ts";
|
|
9
|
+
|
|
10
|
+
export class PluginGroupCommand implements GroupCommand {
|
|
11
|
+
readonly name = "plugin";
|
|
12
|
+
readonly description = "Manage CLI plugins";
|
|
13
|
+
readonly enableConfiguration = false;
|
|
14
|
+
readonly memberSubCommands: ReadonlyArray<SubCommand>;
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
this.memberSubCommands = [
|
|
18
|
+
new PluginListSubCommand(),
|
|
19
|
+
new PluginSearchSubCommand(),
|
|
20
|
+
new PluginAddSubCommand(),
|
|
21
|
+
new PluginRemoveSubCommand(),
|
|
22
|
+
new PluginUpgradeSubCommand(),
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async execute(_context: Context): Promise<void> {}
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
2
|
+
import type Context from "../../../api/Context.ts";
|
|
3
|
+
import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
4
|
+
import type PrinterService from "../../../api/service/core/PrinterService.ts";
|
|
5
|
+
import { PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
|
|
6
|
+
import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
|
|
7
|
+
import type PluginService from "../../../api/service/core/PluginService.ts";
|
|
8
|
+
import { getPluginId } from "./getPluginId.ts";
|
|
9
|
+
|
|
10
|
+
export class PluginListSubCommand implements SubCommand {
|
|
11
|
+
readonly name = "list";
|
|
12
|
+
readonly description = "List locally installed plugins";
|
|
13
|
+
readonly enableConfiguration = false;
|
|
14
|
+
readonly options = [];
|
|
15
|
+
readonly positionals = [];
|
|
16
|
+
|
|
17
|
+
async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
|
|
18
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
19
|
+
const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
|
|
20
|
+
|
|
21
|
+
let found = false;
|
|
22
|
+
for await (const descriptor of pluginService.listInstalled()) {
|
|
23
|
+
if (!found) {
|
|
24
|
+
found = true;
|
|
25
|
+
await printerService.print("Installed plugins:\n");
|
|
26
|
+
}
|
|
27
|
+
await printerService.print(` ${getPluginId(descriptor)} ${descriptor.version}\n`);
|
|
28
|
+
}
|
|
29
|
+
if (!found) {
|
|
30
|
+
await printerService.print("No plugins installed.\n");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
2
|
+
import type Context from "../../../api/Context.ts";
|
|
3
|
+
import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
4
|
+
import { ArgumentValueTypeName } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
5
|
+
import type PrinterService from "../../../api/service/core/PrinterService.ts";
|
|
6
|
+
import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
|
|
7
|
+
import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
|
|
8
|
+
import type PluginService from "../../../api/service/core/PluginService.ts";
|
|
9
|
+
|
|
10
|
+
export class PluginRemoveSubCommand implements SubCommand {
|
|
11
|
+
readonly name = "remove";
|
|
12
|
+
readonly description = "Remove a locally installed plugin";
|
|
13
|
+
readonly enableConfiguration = false;
|
|
14
|
+
readonly options = [];
|
|
15
|
+
readonly positionals = [
|
|
16
|
+
{
|
|
17
|
+
name: "pluginId",
|
|
18
|
+
description: "Plugin ID to remove (e.g. @scope/name)",
|
|
19
|
+
type: ArgumentValueTypeName.STRING,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
|
|
24
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
25
|
+
const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
|
|
26
|
+
|
|
27
|
+
const pluginId = argumentValues["pluginId"] as string;
|
|
28
|
+
await printerService.info(`Removing plugin: ${pluginId}...\n`, Icon.INFORMATION);
|
|
29
|
+
await pluginService.uninstall(pluginId);
|
|
30
|
+
await printerService.print(`Plugin ${pluginId} removed.\n`, Icon.SUCCESS);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
2
|
+
import type Context from "../../../api/Context.ts";
|
|
3
|
+
import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
4
|
+
import { ArgumentValueTypeName } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
5
|
+
import type PrinterService from "../../../api/service/core/PrinterService.ts";
|
|
6
|
+
import { PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
|
|
7
|
+
import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
|
|
8
|
+
import type PluginService from "../../../api/service/core/PluginService.ts";
|
|
9
|
+
import { getPluginId } from "./getPluginId.ts";
|
|
10
|
+
|
|
11
|
+
export class PluginSearchSubCommand implements SubCommand {
|
|
12
|
+
readonly name = "search";
|
|
13
|
+
readonly description = "Search remote plugins";
|
|
14
|
+
readonly enableConfiguration = false;
|
|
15
|
+
readonly options = [];
|
|
16
|
+
readonly positionals = [
|
|
17
|
+
{
|
|
18
|
+
name: "query",
|
|
19
|
+
description: "Search query",
|
|
20
|
+
type: ArgumentValueTypeName.STRING,
|
|
21
|
+
isVarargOptional: true,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
async execute(context: Context, argumentValues: ArgumentValues): Promise<void> {
|
|
26
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
27
|
+
const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
|
|
28
|
+
|
|
29
|
+
const query = (argumentValues["query"] as string | undefined) ?? "";
|
|
30
|
+
let found = false;
|
|
31
|
+
for await (const descriptor of pluginService.search({ text: query })) {
|
|
32
|
+
if (!found) {
|
|
33
|
+
found = true;
|
|
34
|
+
await printerService.print("Available plugins:\n");
|
|
35
|
+
}
|
|
36
|
+
await printerService.print(` ${getPluginId(descriptor)} ${descriptor.version}\n`);
|
|
37
|
+
}
|
|
38
|
+
if (!found) {
|
|
39
|
+
await printerService.print("No plugins found.\n");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type SubCommand from "../../../api/command/SubCommand.ts";
|
|
2
|
+
import type Context from "../../../api/Context.ts";
|
|
3
|
+
import type { ArgumentValues } from "../../../api/argument/ArgumentValueTypes.ts";
|
|
4
|
+
import type PrinterService from "../../../api/service/core/PrinterService.ts";
|
|
5
|
+
import { Icon, PRINTER_SERVICE_ID } from "../../../api/service/core/PrinterService.ts";
|
|
6
|
+
import { PLUGIN_SERVICE_ID } from "../../../api/service/core/PluginService.ts";
|
|
7
|
+
import type PluginService from "../../../api/service/core/PluginService.ts";
|
|
8
|
+
import { getPluginId } from "./getPluginId.ts";
|
|
9
|
+
|
|
10
|
+
export class PluginUpgradeSubCommand implements SubCommand {
|
|
11
|
+
readonly name = "upgrade";
|
|
12
|
+
readonly description = "Upgrade locally installed plugins";
|
|
13
|
+
readonly enableConfiguration = false;
|
|
14
|
+
readonly options = [];
|
|
15
|
+
readonly positionals = [];
|
|
16
|
+
|
|
17
|
+
async execute(context: Context, _argumentValues: ArgumentValues): Promise<void> {
|
|
18
|
+
const printerService = context.getServiceById(PRINTER_SERVICE_ID) as PrinterService;
|
|
19
|
+
const pluginService = context.getServiceById(PLUGIN_SERVICE_ID) as PluginService;
|
|
20
|
+
|
|
21
|
+
let upgraded = 0;
|
|
22
|
+
for await (const update of pluginService.checkForUpdates()) {
|
|
23
|
+
const id = getPluginId(update.descriptor);
|
|
24
|
+
await printerService.info(
|
|
25
|
+
`Upgrading ${id} to ${update.availableVersion}...\n`,
|
|
26
|
+
Icon.INFORMATION,
|
|
27
|
+
);
|
|
28
|
+
await pluginService.install(update.descriptor);
|
|
29
|
+
await printerService.print(`Upgraded ${id} to ${update.availableVersion}.\n`, Icon.SUCCESS);
|
|
30
|
+
upgraded++;
|
|
31
|
+
}
|
|
32
|
+
if (upgraded === 0) {
|
|
33
|
+
await printerService.print("All plugins are up to date.\n");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type TableGeneratorService from "../../api/service/core/TableGeneratorService.ts";
|
|
2
2
|
import { Align } from "../../api/service/core/TableGeneratorService.ts";
|
|
3
|
-
import type
|
|
3
|
+
import type { TableOptions } from "../../api/service/core/TableGeneratorService.ts";
|
|
4
|
+
import Table from "../../api/service/core/Table.ts";
|
|
4
5
|
|
|
5
6
|
const BORDER_TOP_LEFT = "┌";
|
|
6
7
|
const BORDER_TOP = "─";
|
|
@@ -23,6 +24,10 @@ export default class DefaultTableGeneratorService implements TableGeneratorServi
|
|
|
23
24
|
colorFunction: (text: string, hexFormattedColor: string) => string = (text) => text;
|
|
24
25
|
backgroundColorFunction: (text: string, hexFormattedColor: string) => string = (text) => text;
|
|
25
26
|
|
|
27
|
+
createTable(rowCount: number, columnCount: number, options?: TableOptions): Table {
|
|
28
|
+
return new Table(rowCount, columnCount, options);
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
#resolveAlign(table: Table, rowIndex: number, columnIndex: number): Align {
|
|
27
32
|
const cellOpts = table.getCell(rowIndex, columnIndex)?.options;
|
|
28
33
|
if (cellOpts?.align !== undefined) return cellOpts.align;
|
package/src/util/helpHelper.ts
CHANGED
|
@@ -19,7 +19,6 @@ import type PrinterService from "../api/service/core/PrinterService.ts";
|
|
|
19
19
|
import type SubCommandArgument from "../api/argument/SubCommandArgument.ts";
|
|
20
20
|
import type ComplexOption from "../api/argument/ComplexOption.ts";
|
|
21
21
|
import type TableGeneratorService from "../api/service/core/TableGeneratorService.ts";
|
|
22
|
-
import Table from "../api/service/core/Table.ts";
|
|
23
22
|
|
|
24
23
|
const SYNTAX_INDENT_WIDTH = 2;
|
|
25
24
|
const MINIMUM_SYNTAX_COLUMN_WIDTH = 15;
|
|
@@ -112,7 +111,7 @@ export async function printHelpSections(
|
|
|
112
111
|
const hasDescriptions = rows.some((r) => r.description !== undefined);
|
|
113
112
|
|
|
114
113
|
if (hasDescriptions) {
|
|
115
|
-
const table =
|
|
114
|
+
const table = tableGeneratorService.createTable(rows.length, 2, {
|
|
116
115
|
border: false,
|
|
117
116
|
padding: 1,
|
|
118
117
|
maxWidth: terminalWidth,
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type GroupCommand from "../api/command/GroupCommand.ts";
|
|
2
|
-
import type SubCommand from "../api/command/SubCommand.ts";
|
|
3
|
-
import type Option from "../api/argument/Option.ts";
|
|
4
|
-
import type Positional from "../api/argument/Positional.ts";
|
|
5
|
-
import type Context from "../api/Context.ts";
|
|
6
|
-
import { type ArgumentValues } from "../api/argument/ArgumentValueTypes.ts";
|
|
7
|
-
export declare class CompletionIntegrationSubCommand implements SubCommand {
|
|
8
|
-
readonly name = "integration";
|
|
9
|
-
readonly description = "Install shell completion integration";
|
|
10
|
-
readonly enableConfiguration = false;
|
|
11
|
-
readonly options: ReadonlyArray<Option>;
|
|
12
|
-
readonly positionals: ReadonlyArray<Positional>;
|
|
13
|
-
execute(context: Context, argumentValues: ArgumentValues): Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
export declare class CompletionCompleteSubCommand implements SubCommand {
|
|
16
|
-
readonly name = "complete";
|
|
17
|
-
readonly description = "Generate completions for shell integration";
|
|
18
|
-
readonly enableConfiguration = false;
|
|
19
|
-
readonly disableGenericHelpDisplay = true;
|
|
20
|
-
readonly options: ReadonlyArray<Option>;
|
|
21
|
-
readonly positionals: ReadonlyArray<Positional>;
|
|
22
|
-
execute(context: Context, argumentValues: ArgumentValues): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export declare class CompletionGroupCommand implements GroupCommand {
|
|
25
|
-
readonly name = "completions";
|
|
26
|
-
readonly description = "Manage shell auto-completion";
|
|
27
|
-
readonly enableConfiguration = false;
|
|
28
|
-
readonly memberSubCommands: ReadonlyArray<SubCommand>;
|
|
29
|
-
constructor(integrationCommand: CompletionIntegrationSubCommand, completeCommand: CompletionCompleteSubCommand);
|
|
30
|
-
execute(_context: Context): Promise<void>;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=CompletionCommand.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompletionCommand.d.ts","sourceRoot":"","sources":["../../../src/command/CompletionCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,YAAY,MAAM,gCAAgC,CAAC;AAC/D,OAAO,KAAK,UAAU,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,uCAAuC,CAAC;AAMnG,qBAAa,+BAAgC,YAAW,UAAU;IAChE,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,0CAA0C;IAC9D,QAAQ,CAAC,mBAAmB,SAAS;IAErC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAOrC;IAEF,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAO7C;IAEI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA4D/E;AAED,qBAAa,4BAA6B,YAAW,UAAU;IAC7D,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,WAAW,gDAAgD;IACpE,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,yBAAyB,QAAQ;IAE1C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAM;IAE7C,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,UAAU,CAAC,CAc7C;IAEI,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAqB/E;AAED,qBAAa,sBAAuB,YAAW,YAAY;IACzD,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,kCAAkC;IACtD,QAAQ,CAAC,mBAAmB,SAAS;IACrC,QAAQ,CAAC,iBAAiB,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;gBAGpD,kBAAkB,EAAE,+BAA+B,EACnD,eAAe,EAAE,4BAA4B;IAKzC,OAAO,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAChD"}
|