Skip to content

Commit

Permalink
Use axocli
Browse files Browse the repository at this point in the history
  • Loading branch information
mistydemeo committed Jan 22, 2024
1 parent 2bb1c06 commit 88eb3d6
Show file tree
Hide file tree
Showing 3 changed files with 226 additions and 11 deletions.
212 changes: 212 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ repository = "https://github.com/axodotdev/axoupdater"
name = "axoupdater"
path = "src/lib.rs"

[features]
standalone = ["axocli"]

[dependencies]
axoasset = { version = "0.6.1", default-features = false, features = ["json-serde"]}
axocli = { version = "0.1.1", optional = true }
axoprocess = "0.1.0"
camino = { version = "1.1.6", features = ["serde1"] }
homedir = "0.2.1"
Expand All @@ -23,3 +27,7 @@ temp-dir = "0.1.12"
# errors
miette = "5.6.0"
thiserror = "1.0.56"

[[bin]]
name = "axoupdater"
required-features = ["axocli"]
17 changes: 6 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::process::exit;
use axocli::{CliApp, CliAppBuilder};
use axoupdater::AxoUpdater;

use axoupdater::{AxoUpdater, AxoupdateResult};
struct CliArgs {}

fn real_main() -> AxoupdateResult<()> {
fn real_main(_cli: &CliApp<CliArgs>) -> Result<(), miette::Report> {
if AxoUpdater::new_for_updater_executable()?
.load_receipt()?
.run()?
Expand All @@ -15,12 +16,6 @@ fn real_main() -> AxoupdateResult<()> {
Ok(())
}

fn main() -> std::io::Result<()> {
match real_main() {
Ok(_) => Ok(()),
Err(e) => {
eprintln!("{e}");
exit(1)
}
}
fn main() {
CliAppBuilder::new("axoupdater").start(CliArgs {}, real_main);
}

0 comments on commit 88eb3d6

Please sign in to comment.