Repository navigation
(GH-461) Add command plug-ins to extend dsc with new commands - #1808
Draft
Gijs Reijn (Gijsreyn) wants to merge 1 commit into
Draft
Gijs Reijn (Gijsreyn) wants to merge 1 commit into
Gijs Reijn (Gijsreyn) wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This change:
*.dsc.plugin.json(or.yaml/.yml) manifest becomes adsc <command>subcommand.dsc plugin list, a "Plug-in commands" section indsc --help, plug-in names indsc completer, anddsc schema --type plugin-manifest.plugins.enabledsetting to turn plug-ins off, also from the policy file.dsc.exe#461.PR Context
The working group asked for a way to extend
dscwith commands that ship separately, the waygitand the .NET CLI do. The first candidate isdsclintfrom #1768, which should be reachable asdsc lintwithout compiling the linter intodsc.DSC finds plug-in manifests in the same directories as resource and extension manifests, so installing a plug-in is the same as installing a resource. When the first argument isn't a built-in command, DSC looks for a plug-in with that command name, starts its executable with the remaining arguments, and returns its exit code. Standard input, output and error are passed through untouched.
Remarks on the design
dsc OpenDSC/Lintruns that exact plug-in regardless of who owns thelintcommand. The match is case-insensitive.DSC_EXE,DSC_VERSION,DSC_PLUGIN_COMMAND(what the user typed),DSC_PLUGIN_DIR, and forwards the trace level, trace format, progress format and ignore-settings choice as environment variables. Options given before the command name, such as--trace-level, reach the plug-in this way.dsc help <command>anddsc <command> --helpare forwarded to the plug-in. A mistyped built-in command still gets the "did you mean" tip.plugins.enabledset tofalse, plug-ins aren't discovered or run, and unknown commands fail as they do today.pluginsarray is accepted in manifest list files, next to resources and extensions.