Skip to content

Commit 8b0a926

Browse files
committed
add update command
1 parent 7411257 commit 8b0a926

5 files changed

Lines changed: 467 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 180 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ tar = "0.4"
3737
semver = "1"
3838
sqlformat = "0.5.0"
3939
sysinfo = { version = "0.38.4", default-features = false, features = ["system"] }
40+
self_update = { version = "0.42", default-features = false, features = ["rustls"] }
41+
lzma-rs = "0.3"
4042

4143
[dev-dependencies]
4244
mockito = "1"

src/command.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ pub enum Commands {
223223
#[arg(value_enum)]
224224
shell: ShellChoice,
225225
},
226+
227+
/// Update the hotdata CLI to the latest release
228+
Update,
226229
}
227230

228231
#[derive(Clone, clap::ValueEnum)]

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ mod sandbox_session;
1818
mod skill;
1919
mod table;
2020
mod tables;
21+
mod update;
2122
mod util;
2223
mod workspace;
2324

@@ -148,6 +149,12 @@ fn main() {
148149
skill::maybe_auto_update_after_cli_upgrade();
149150
}
150151

152+
// Quiet update-available notice. Skip during `hotdata update` itself so
153+
// we don't talk over the updater's own output.
154+
if !matches!(&cli.command, Some(Commands::Update)) {
155+
update::maybe_print_update_notice();
156+
}
157+
151158
match cli.command {
152159
None => {
153160
use clap::CommandFactory;
@@ -781,6 +788,7 @@ fn main() {
781788
let mut cmd = Cli::command();
782789
generate(shell, &mut cmd, "hotdata", &mut std::io::stdout());
783790
}
791+
Commands::Update => update::run_update(),
784792
},
785793
}
786794
}

0 commit comments

Comments
 (0)