refactor: make update fn take &ExectionContext & put update fn together (#457)

This commit is contained in:
SteveLauC
2023-06-03 04:20:42 +08:00
committed by GitHub
parent a0ff565220
commit 658829e4ff
5 changed files with 157 additions and 174 deletions

View File

@@ -460,7 +460,7 @@ pub fn run_pearl(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type().execute(pearl).arg("update").status_checked()
}
pub fn run_sdkman(cleanup: bool, ctx: &ExecutionContext) -> Result<()> {
pub fn run_sdkman(ctx: &ExecutionContext) -> Result<()> {
let bash = require("bash")?;
let sdkman_init_path = var("SDKMAN_DIR")
@@ -506,7 +506,7 @@ pub fn run_sdkman(cleanup: bool, ctx: &ExecutionContext) -> Result<()> {
.args(["-c", cmd_upgrade.as_str()])
.status_checked()?;
if cleanup {
if ctx.config().cleanup() {
let cmd_flush_archives = format!("source {} && sdk flush archives", &sdkman_init_path);
ctx.run_type()
.execute(&bash)