refactor(scoop-shim): Use getopt to parse arguments#5125
Merged
niheaven merged 3 commits intoScoopInstaller:developfrom Sep 11, 2022
Merged
refactor(scoop-shim): Use getopt to parse arguments#5125niheaven merged 3 commits intoScoopInstaller:developfrom
getopt to parse arguments#5125niheaven merged 3 commits intoScoopInstaller:developfrom
Conversation
Member
|
I'll review it in a few days, thank you for the PR. |
Contributor
Author
|
@niheaven Any suggestions? :) |
- Rename '$Arguments' to '$other' - Change some help text - Support '*' and '-g' for list
Member
|
Just see my commit, now LGTM. |
Contributor
Author
|
Shall we move on? |
niheaven
approved these changes
Sep 11, 2022
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.
Description
Use
getoptto parse arguments, which avoids some problems. BTW, add some logic and tweak some error messages.Motivation and Context
These problems will be resolved:
For example, run
scoop shim add myapp '', the second parameter (<command_path>) gets an empty value, so Scoop will throw an exception, which is not so friendly. :For example, run
scoop shim list *, the regex pattern*is invalid, so Scoop will throw an exception, which is not so friendly. :The
-g/--globaloption cannot be parsed inscoop shim .... See [Bug]scoop shim info : ERROR: Option -global not recognized. #5094.How Has This Been Tested?
Now with this:
scoop shim add myapp ''shows an error:scoop shim list *shows an error:To create a local shim
myappwithargand--globalas arguments:Note that we have to use a QUOTED command option terminator (
'--') in PowerShell CLI.To create a global shim
myappwithargas the argument:No major changes to other subcommands.
Checklist:
developbranch.