feat: --version flag
This commit is contained in:
parent
8c12dfc132
commit
a5fd6bf61a
10
src/main.rs
10
src/main.rs
|
@ -971,14 +971,24 @@ async fn serve() {
|
|||
#[derive(FromArgs, PartialEq, Debug)]
|
||||
/// Start lonk.
|
||||
struct Run {
|
||||
/// print the version and quit
|
||||
#[argh(switch)]
|
||||
version: bool,
|
||||
/// write a default configuration to stdout and quit
|
||||
#[argh(switch)]
|
||||
print_default_config: bool,
|
||||
}
|
||||
|
||||
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
fn main() {
|
||||
let run = argh::from_env::<Run>();
|
||||
|
||||
if run.version {
|
||||
println!("lonk v{}", VERSION);
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
||||
if run.print_default_config {
|
||||
println!(
|
||||
"{}",
|
||||
|
|
Loading…
Reference in New Issue