-
Notifications
You must be signed in to change notification settings - Fork 14
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
Add additional generic components and helpers #224
base: main
Are you sure you want to change the base?
Conversation
|
||
type commandKey struct{} | ||
|
||
func WithCommand(ctx context.Context, cmd *cobra.Command) context.Context { |
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.
Should we rename this to WithContext
? So, invocation will be command.WithContext(ctx, cmd)
?
return context.WithValue(ctx, commandKey{}, cmd) | ||
} | ||
|
||
func CommandFromContext(ctx context.Context) *cobra.Command { |
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.
Should we rename this to FromContext
? So, invocation will be command.FromContext(ctx)
?
9314b92
to
81995d3
Compare
81995d3
to
5a47482
Compare
const ( | ||
NameArgumentName = "name" | ||
NamesArgumentName = "name(s)" | ||
) |
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.
Are these generic enough to be kept here? Also applies to NameArg, OptionalNameArg, NamesArg functions below.
What this PR does / why we need it
Which issue(s) this PR fixes
Fixes #
Describe testing done for PR
Release note
Additional information
Special notes for your reviewer