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
gh alias delete #1103
gh alias delete #1103
Conversation
dc76fe0
to
df0756f
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 great!
command/alias.go
Outdated
return fmt.Errorf("no such alias %s", alias) | ||
} | ||
|
||
expansion := aliasCfg.Get(alias) |
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.
I was wondering what the return value would be if you didn't check for existence on line 137. This got me thinking about making the Get
method work more like the Go map lookup. So the interface would be:
func Get(alias string) (value string, found bool)
This isn't something we have to do, but it feels like it might be more standard Go style.
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.
that would make sense 👍
content := cm.Root.Content | ||
for i := 0; i < len(content); i++ { | ||
if content[i].Value == key { | ||
i++ // skip the next node which is this key's value |
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.
This confused me, but I think it's mostly because iterating over YAML nodes is weird. But from what I can find this is just how it works?
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.
sadly yes this is how it works 😅
closes #990
This PR adds
gh alias delete <alias>
. It's pretty straightforward.Part of #936
See also #989