Add JetBrains Toolbox via jetbrains-toolbox-updater (#1064)
* Add jetbrains-toolbox-updater * Update jetbrains-toolbox-updater * Update jetbrains-toolbox-updater * Update jetbrains-toolbox-updater * Localize prints * Update jetbrains-toolbox-updater * Format * Add localization * Fix translation
This commit is contained in:
@@ -98,6 +98,7 @@ pub enum Step {
|
||||
Haxelib,
|
||||
Helm,
|
||||
HomeManager,
|
||||
JetBrainsToolbox,
|
||||
Jetpack,
|
||||
Julia,
|
||||
Juliaup,
|
||||
|
||||
@@ -446,6 +446,9 @@ fn run() -> Result<()> {
|
||||
runner.execute(Step::Aqua, "aqua", || generic::run_aqua(&ctx))?;
|
||||
runner.execute(Step::Bun, "bun", || generic::run_bun(&ctx))?;
|
||||
runner.execute(Step::Zigup, "zigup", || generic::run_zigup(&ctx))?;
|
||||
runner.execute(Step::JetBrainsToolbox, "JetBrains Toolbox", || {
|
||||
generic::run_jetbrains_toolbox(&ctx)
|
||||
})?;
|
||||
|
||||
if should_run_powershell {
|
||||
runner.execute(Step::Powershell, "Powershell Modules Update", || {
|
||||
|
||||
@@ -9,6 +9,7 @@ use std::{fs, io::Write};
|
||||
use color_eyre::eyre::eyre;
|
||||
use color_eyre::eyre::Context;
|
||||
use color_eyre::eyre::Result;
|
||||
use jetbrains_toolbox_updater::{find_jetbrains_toolbox, update_jetbrains_toolbox, FindError};
|
||||
use lazy_static::lazy_static;
|
||||
use regex::bytes::Regex;
|
||||
use rust_i18n::t;
|
||||
@@ -1344,3 +1345,42 @@ pub fn run_zigup(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run_jetbrains_toolbox(_ctx: &ExecutionContext) -> Result<()> {
|
||||
let installation = find_jetbrains_toolbox();
|
||||
match installation {
|
||||
Err(FindError::NotFound) => {
|
||||
// Skip
|
||||
Err(SkipStep(format!("{}", t!("No JetBrains Toolbox installation found"))).into())
|
||||
}
|
||||
Err(FindError::UnsupportedOS(os)) => {
|
||||
// Skip
|
||||
Err(SkipStep(format!("{}", t!("Unsupported operating system {os}", os = os))).into())
|
||||
}
|
||||
Err(e) => {
|
||||
// Unexpected error
|
||||
println!(
|
||||
"{}",
|
||||
t!("jetbrains-toolbox-updater encountered an unexpected error during finding:")
|
||||
);
|
||||
println!("{e:?}");
|
||||
Err(StepFailed.into())
|
||||
}
|
||||
Ok(installation) => {
|
||||
print_separator("JetBrains Toolbox");
|
||||
|
||||
match update_jetbrains_toolbox(installation) {
|
||||
Err(e) => {
|
||||
// Unexpected error
|
||||
println!(
|
||||
"{}",
|
||||
t!("jetbrains-toolbox-updater encountered an unexpected error during updating:")
|
||||
);
|
||||
println!("{e:?}");
|
||||
Err(StepFailed.into())
|
||||
}
|
||||
Ok(()) => Ok(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user