aboutsummaryrefslogtreecommitdiffstats
path: root/src/action.rs
diff options
context:
space:
mode:
authorGravatar BanceDev 2026-02-26 22:24:15 -0500
committerGravatar BanceDev 2026-02-26 22:24:15 -0500
commit8c9b627d7449a53238631ec01cfcb5f778fd4e5c (patch)
tree65ad6e1c63f3ef8256bb9914ea727723ac19c0d1 /src/action.rs
parentbegin permissions shift for build commands (diff)
add version flag
Diffstat (limited to 'src/action.rs')
-rw-r--r--src/action.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/action.rs b/src/action.rs
index 58effbe..fe405a3 100644
--- a/src/action.rs
+++ b/src/action.rs
@@ -17,6 +17,7 @@ pub enum Action {
Search { term: String },
Clean { packages: Vec<String> },
Show { package: String },
+ Version,
}
impl Action {
@@ -56,6 +57,7 @@ impl Action {
let package = args.get(2).ok_or("show requires <package>")?.clone();
Ok(Action::Show { package })
}
+ "--version" => Ok(Action::Version),
_ => Err(format!("unknown command {}", cmd)),
}
}
@@ -71,6 +73,7 @@ impl Action {
Action::Search { term } => Ok(search(term)),
Action::Clean { packages } => Ok(clean(packages)),
Action::Show { package } => Ok(show(package)),
+ Action::Version => Ok(version()),
}
}
}
@@ -217,3 +220,16 @@ fn clean(packages: Vec<String>) {
fn show(package: String) {
println!("showing {}", package);
}
+
+fn version() {
+ println!(
+ r#"
+.-------..___ Forge v{}
+'-._ :_.-' Copyright (C) 2026 Lance Borden
+ ) _ (
+ '-' '-' This program is free software
+ under the MIT license.
+ "#,
+ env!("CARGO_PKG_VERSION")
+ );
+}