mirror of
https://github.com/starship/starship.git
synced 2026-06-23 02:05:51 +07:00
feat: Modify config keys from shell (#1095)
* feat: Modify config keys from shell * chore: Fix clippy * refactor: Add `configure` as alias * chore: Remove redundant code * fix: Soft error if user doesn't pass in valid key * feat: Support integers and booleans * chore: Fix clippy * refactor: Use exit instead of abort Co-Authored-By: Thomas O'Donnell <andytom@users.noreply.github.com> Co-authored-by: Thomas O'Donnell <andytom@users.noreply.github.com>
This commit is contained in:
+21
-2
@@ -116,7 +116,18 @@ fn main() {
|
||||
.arg(&keymap_arg)
|
||||
.arg(&jobs_arg),
|
||||
)
|
||||
.subcommand(SubCommand::with_name("configure").about("Edit the starship configuration"))
|
||||
.subcommand(
|
||||
SubCommand::with_name("config")
|
||||
.alias("configure")
|
||||
.about("Edit the starship configuration")
|
||||
.arg(
|
||||
Arg::with_name("name")
|
||||
.help("Configuration key to edit")
|
||||
.required(false)
|
||||
.requires("value"),
|
||||
)
|
||||
.arg(Arg::with_name("value").help("Value to place into that key")),
|
||||
)
|
||||
.subcommand(SubCommand::with_name("bug-report").about(
|
||||
"Create a pre-populated GitHub issue with information about your configuration",
|
||||
))
|
||||
@@ -152,7 +163,15 @@ fn main() {
|
||||
print::module(module_name, sub_m.clone());
|
||||
}
|
||||
}
|
||||
("configure", Some(_)) => configure::edit_configuration(),
|
||||
("config", Some(sub_m)) => {
|
||||
if let Some(name) = sub_m.value_of("name") {
|
||||
if let Some(value) = sub_m.value_of("value") {
|
||||
configure::update_configuration(name, value)
|
||||
}
|
||||
} else {
|
||||
configure::edit_configuration()
|
||||
}
|
||||
}
|
||||
("bug-report", Some(_)) => bug_report::create(),
|
||||
("time", _) => {
|
||||
match SystemTime::now()
|
||||
|
||||
Reference in New Issue
Block a user