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
feat(command): add 'toggle' command #1917
Conversation
4c4ee77
to
38ad54a
Compare
Hey, @andytom, sorry for pinging, any updates about this? |
.value_name("SHELL") | ||
.help( | ||
"The name of the currently running shell\nCurrently supported options: bash, zsh, fish, powershell, ion", | ||
) | ||
.required(true); | ||
.value_name("SHELL") | ||
.help( | ||
"The name of the currently running shell\nCurrently supported options: bash, zsh, fish, powershell, ion", | ||
) | ||
.required(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.
I'm not sure what if anything is changing here, is this just a whitespace change? If so is it required?
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.
src/configure.rs
Outdated
|
||
pub fn toggle_configuration(name: &str, key: &str) { | ||
if let Some(table) = get_configuration().as_table_mut() { | ||
if let Some(values) = table.get(name).unwrap().as_table() { |
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.
As you mentioned in the PR description I think it would be better if we handled this a bit more gracefully, maybe we could log an error here if the module section is not set in the config file?
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.
Good catch! It's done. Now it should log Given module 'winamp' not found in config file
and exit(1)
in case of error.
Closes starship#894 Signed-off-by: Dentrax <furkan.turkal@hotmail.com>
38ad54a
to
f10e825
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.
LGTM
Thanks for you contribution @Dentrax. |
Closes starship#894 Signed-off-by: Dentrax <furkan.turkal@hotmail.com>
Closes starship#894 Signed-off-by: Dentrax <furkan.turkal@hotmail.com>
Closes #894
Signed-off-by: Dentrax furkan.turkal@hotmail.com
Description
See the given issue in order to get more description about the
toggle
feature.Motivation and Context
As requested at #894 and #1873, this PR adds brand new
toggle
command.Screenshots (if appropriate):
How Has This Been Tested?
See the error:
[ERROR] - (starship::configure): Given config key 'show_namespace' must be exist in config file
non-boolean
flag key exist with arg:See the error:
[ERROR] - (starship::configure): Given config key 'format' must be in 'boolean' format
This will panic-ed, it works the same as the
update_configuration()
function. We just ignored theNone
case, by using this:table.get(keys[0]).unwrap()
. Shouldn't we cover the case ofNone
? What about adding a new fatal message like:[ERROR] - (starship::configure): Given module 'winamp' not found in config file
Same as above.
Checklist:
Some help wanted here too! :)
**Happy aliases, you astronauts! **
alias k8s!='cargo run toggle kubernetes'