summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs45
1 files changed, 26 insertions, 19 deletions
diff --git a/src/main.rs b/src/main.rs
index 118d06e..5881102 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,7 +3,7 @@ use std::path::PathBuf;
use clap::{Parser, Subcommand};
use aur_build::config::Config;
-use aur_build::db::{self, builds, model::*};
+use aur_build::db::{self, builds, model::BuildState};
use aur_build::pipeline;
use aur_build::review::candidates;
use aur_build::usecase;
@@ -30,13 +30,19 @@ enum Cmd {
#[arg(long)]
url: Option<String>,
},
- Unsubscribe { pkgbase: String },
- Detect { pkgbase: Option<String> },
+ Unsubscribe {
+ pkgbase: String,
+ },
+ Detect {
+ pkgbase: Option<String>,
+ },
Reviews {
#[arg(long)]
all: bool,
},
- Show { candidate: i64 },
+ Show {
+ candidate: i64,
+ },
Approve {
candidate: i64,
#[arg(long)]
@@ -53,11 +59,19 @@ enum Cmd {
#[arg(long)]
note: String,
},
- Build { candidate: i64 },
- Rebuild { pkgbase: String },
- Run { build: String },
+ Build {
+ candidate: i64,
+ },
+ Rebuild {
+ pkgbase: String,
+ },
+ Run {
+ build: String,
+ },
Builds,
- Status { build: String },
+ Status {
+ build: String,
+ },
Packages,
Serve {
#[arg(long)]
@@ -83,10 +97,7 @@ fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
let root = cli.root.clone().unwrap_or_else(|| Config::default().root);
let cfg = if matches!(cli.cmd, Cmd::Init { .. }) {
- Config::load(&root).unwrap_or_else(|_| Config {
- root: root.clone(),
- ..Config::default()
- })
+ Config::load(&root).unwrap_or_else(|_| Config { root: root.clone(), ..Config::default() })
} else {
Config::load(&root)?
};
@@ -141,11 +152,8 @@ fn main() -> anyhow::Result<()> {
Ok(())
}
Cmd::Reviews { all } => {
- let rows = if all {
- candidates::all_candidates(&ctx.db)?
- } else {
- candidates::pending_candidates(&ctx.db)?
- };
+ let rows =
+ if all { candidates::all_candidates(&ctx.db)? } else { candidates::pending_candidates(&ctx.db)? };
if rows.is_empty() {
println!("nothing pending");
}
@@ -289,7 +297,7 @@ fn main() -> anyhow::Result<()> {
let path = usecase::backup(&ctx.db, &to)?;
println!(
"wrote {} bytes to {} (VACUUM INTO, single file, no WAL)",
- std::fs::metadata(&path).map(|m| m.len()).unwrap_or(0),
+ std::fs::metadata(&path).map_or(0, |m| m.len()),
path.display()
);
Ok(())
@@ -310,4 +318,3 @@ impl Ctx {
fn whoami() -> String {
std::env::var("USER").or_else(|_| std::env::var("USERNAME")).unwrap_or_else(|_| "cli".into())
}
-