-
Notifications
You must be signed in to change notification settings - Fork 113
Add stellar keys use --clear to clear the default identity.
#2332
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
Conversation
The option on this keys use command doesn't feel natural or intuitive to me. If we look at other commands for inspiration, k8s uses a separate command to clear the selected: What about something like: And then the same with the network: |
| pub name: String, | ||
| pub name: Option<String>, | ||
|
|
||
| /// Clear the default source account. | ||
| #[arg(long)] | ||
| pub clear: bool, |
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 omit the clear: bool, and just make it if name is None, then clear it?
| if self.clear && self.name.is_some() { | ||
| return Err(Error::NameWithClear); | ||
| } | ||
|
|
||
| if !self.clear && self.name.is_none() { | ||
| return Err(Error::NameRequired); | ||
| } |
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.
If we omitted the bool, then we wouldn't need these condition checks.
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.
Having clap manage this might make it easier:
clap::ArgGroup::new("Key")
.required(true)
.args(& ["name", "clear"]),
|
I don't feel strongly about it. An upside is that the --clear is discoverable inside the help of the command. |
mootz12
left a comment
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 agree --clear probably isn't the "clear"-est naming. I think the best option would be to just use unset directly.
e.g.
stellar keys unset
stellar network unset
stellar fees unset
Thoughts @fnando @leighmcculloch ?
I'll update the #2321 for fees, maybe we could include network unset in this PR as well.
| if self.clear && self.name.is_some() { | ||
| return Err(Error::NameWithClear); | ||
| } | ||
|
|
||
| if !self.clear && self.name.is_none() { | ||
| return Err(Error::NameRequired); | ||
| } |
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.
Having clap manage this might make it easier:
clap::ArgGroup::new("Key")
.required(true)
.args(& ["name", "clear"]),
|
Oh I like the 'unset' vocab. That's better than 'clear-use'. |
|
Closing this in favor of #2337, which implements |
What
Why
So users have a way to clear the default identity.
Known limitations
N/A