From 601bd08c0c1b5b86f4a016fa8d4acb080416cd83 Mon Sep 17 00:00:00 2001 From: pythcoiner Date: Fri, 2 Feb 2024 12:08:34 +0100 Subject: [PATCH] add -v / --version args --- gui/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gui/src/main.rs b/gui/src/main.rs index d775143f..0698139a 100644 --- a/gui/src/main.rs +++ b/gui/src/main.rs @@ -1,6 +1,6 @@ #![windows_subsystem = "windows"] -use std::{error::Error, io::Write, path::PathBuf, str::FromStr}; +use std::{error::Error, io::Write, path::PathBuf, process, str::FromStr}; use iced::{executor, Application, Command, Settings, Subscription}; use tracing::{error, info}; @@ -21,6 +21,7 @@ use liana_gui::{ launcher::{self, Launcher}, loader::{self, Loader}, logger::Logger, + VERSION, }; #[derive(Debug, PartialEq)] @@ -32,6 +33,12 @@ enum Arg { fn parse_args(args: Vec) -> Result, Box> { let mut res = Vec::new(); + + if args.len() > 1 && (args[1] == "--version" || args[1] == "-v") { + eprintln!("{}", VERSION); + process::exit(1); + } + for (i, arg) in args.iter().enumerate() { if arg == "--conf" { if let Some(a) = args.get(i + 1) {