Add minor refactorings (#754)
This commit is contained in:
@@ -74,7 +74,7 @@ pub fn run_fisher(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
|
||||
|
||||
print_separator("Fisher");
|
||||
|
||||
run_type.execute(&fish).args(&["-c", "fisher update"]).check_run()
|
||||
run_type.execute(&fish).args(["-c", "fisher update"]).check_run()
|
||||
}
|
||||
|
||||
pub fn run_bashit(ctx: &ExecutionContext) -> Result<()> {
|
||||
@@ -84,7 +84,7 @@ pub fn run_bashit(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
ctx.run_type()
|
||||
.execute("bash")
|
||||
.args(&["-lic", &format!("bash-it update {}", ctx.config().bashit_branch())])
|
||||
.args(["-lic", &format!("bash-it update {}", ctx.config().bashit_branch())])
|
||||
.check_run()
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ pub fn run_oh_my_fish(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
print_separator("oh-my-fish");
|
||||
|
||||
ctx.run_type().execute(&fish).args(&["-c", "omf update"]).check_run()
|
||||
ctx.run_type().execute(&fish).args(["-c", "omf update"]).check_run()
|
||||
}
|
||||
|
||||
pub fn run_pkgin(ctx: &ExecutionContext) -> Result<()> {
|
||||
@@ -127,7 +127,7 @@ pub fn run_fish_plug(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
print_separator("fish-plug");
|
||||
|
||||
ctx.run_type().execute(&fish).args(&["-c", "plug update"]).check_run()
|
||||
ctx.run_type().execute(&fish).args(["-c", "plug update"]).check_run()
|
||||
}
|
||||
|
||||
pub fn run_brew_formula(ctx: &ExecutionContext, variant: BrewVariant) -> Result<()> {
|
||||
@@ -138,7 +138,7 @@ pub fn run_brew_formula(ctx: &ExecutionContext, variant: BrewVariant) -> Result<
|
||||
variant.execute(run_type).arg("update").check_run()?;
|
||||
variant
|
||||
.execute(run_type)
|
||||
.args(&["upgrade", "--ignore-pinned", "--formula"])
|
||||
.args(["upgrade", "--ignore-pinned", "--formula"])
|
||||
.check_run()?;
|
||||
|
||||
if ctx.config().cleanup() {
|
||||
@@ -156,19 +156,19 @@ pub fn run_brew_cask(ctx: &ExecutionContext, variant: BrewVariant) -> Result<()>
|
||||
|
||||
let cask_upgrade_exists = variant
|
||||
.execute(RunType::Wet)
|
||||
.args(&["--repository", "buo/cask-upgrade"])
|
||||
.args(["--repository", "buo/cask-upgrade"])
|
||||
.check_output()
|
||||
.map(|p| Path::new(p.trim()).exists())?;
|
||||
|
||||
let mut brew_args = vec![];
|
||||
|
||||
if cask_upgrade_exists {
|
||||
brew_args.extend(&["cu", "-y"]);
|
||||
brew_args.extend(["cu", "-y"]);
|
||||
if ctx.config().brew_cask_greedy() {
|
||||
brew_args.push("-a");
|
||||
}
|
||||
} else {
|
||||
brew_args.extend(&["upgrade", "--cask"]);
|
||||
brew_args.extend(["upgrade", "--cask"]);
|
||||
if ctx.config().brew_cask_greedy() {
|
||||
brew_args.push("--greedy");
|
||||
}
|
||||
@@ -205,10 +205,7 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
if multi_user {
|
||||
if let Some(sudo) = ctx.sudo() {
|
||||
run_type
|
||||
.execute(&sudo)
|
||||
.args(&["-i", "nix", "upgrade-nix"])
|
||||
.check_run()?;
|
||||
run_type.execute(&sudo).args(["-i", "nix", "upgrade-nix"]).check_run()?;
|
||||
} else {
|
||||
print_warning("Need sudo to upgrade Nix");
|
||||
}
|
||||
@@ -238,7 +235,7 @@ pub fn run_asdf(run_type: RunType) -> Result<()> {
|
||||
return Err(TopgradeError::ProcessFailed(e).into());
|
||||
}
|
||||
}
|
||||
run_type.execute(&asdf).args(&["plugin", "update", "--all"]).check_run()
|
||||
run_type.execute(&asdf).args(["plugin", "update", "--all"]).check_run()
|
||||
}
|
||||
|
||||
pub fn run_home_manager(run_type: RunType) -> Result<()> {
|
||||
@@ -276,32 +273,20 @@ pub fn run_sdkman(base_dirs: &BaseDirs, cleanup: bool, run_type: RunType) -> Res
|
||||
print_separator("SDKMAN!");
|
||||
|
||||
let cmd_selfupdate = format!("source {} && sdk selfupdate", &sdkman_init_path);
|
||||
run_type
|
||||
.execute(&bash)
|
||||
.args(&["-c", cmd_selfupdate.as_str()])
|
||||
.check_run()?;
|
||||
run_type.execute(&bash).args(["-c", &cmd_selfupdate]).check_run()?;
|
||||
|
||||
let cmd_update = format!("source {} && sdk update", &sdkman_init_path);
|
||||
run_type.execute(&bash).args(&["-c", cmd_update.as_str()]).check_run()?;
|
||||
run_type.execute(&bash).args(["-c", &cmd_update]).check_run()?;
|
||||
|
||||
let cmd_upgrade = format!("source {} && sdk upgrade", &sdkman_init_path);
|
||||
run_type
|
||||
.execute(&bash)
|
||||
.args(&["-c", cmd_upgrade.as_str()])
|
||||
.check_run()?;
|
||||
run_type.execute(&bash).args(["-c", &cmd_upgrade]).check_run()?;
|
||||
|
||||
if cleanup {
|
||||
let cmd_flush_archives = format!("source {} && sdk flush archives", &sdkman_init_path);
|
||||
run_type
|
||||
.execute(&bash)
|
||||
.args(&["-c", cmd_flush_archives.as_str()])
|
||||
.check_run()?;
|
||||
run_type.execute(&bash).args(["-c", &cmd_flush_archives]).check_run()?;
|
||||
|
||||
let cmd_flush_temp = format!("source {} && sdk flush temp", &sdkman_init_path);
|
||||
run_type
|
||||
.execute(&bash)
|
||||
.args(&["-c", cmd_flush_temp.as_str()])
|
||||
.check_run()?;
|
||||
run_type.execute(&bash).args(["-c", &cmd_flush_temp]).check_run()?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user