-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apps, apis, rules: first stab at generalizing picker options [CLI-82] #182
Conversation
This is mostly an internal only change which extracts the behavior of having `pickers`. == TODO - [ ] Try it out with apps - [ ] Try it out with apis
@@ -0,0 +1,32 @@ | |||
package cli | |||
|
|||
type pickerOptions []pickerOption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous iteration using maps
had an undesirable behavior that options get randomized on every run. Formalizing this data structure to a list to have a deterministic order -- but also having methods on the list simplifies the call sites.
This comment has been minimized.
This comment has been minimized.
4ef31b2
to
6520c3a
Compare
6520c3a
to
f6ef9a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, only some small things to address.
Co-authored-by: Rita Zerrizuela <[email protected]>
|
||
return fmt.Errorf("Missing a required argument: %s", a.GetName()) | ||
} | ||
|
||
func askArgument(cmd *cobra.Command, i commandInput, value interface{}) error { | ||
if canPrompt(cmd) { | ||
return ask(cmd, i, value, nil, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ask(cmd, i, value, nil, true) | |
return ask(cmd, i, value, nil, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
Description
Demo