Merge #954: [GUI] Add version args
601bd08c0c1b5b86f4a016fa8d4acb080416cd83 add -v / --version args (pythcoiner) Pull request description: fixes #896  ACKs for top commit: edouardparis: ACK 601bd08c0c1b5b86f4a016fa8d4acb080416cd83 Tree-SHA512: ca54927141bc1115fae04480dbe1867cafd30955278e1845d4170079d4ce13300e722b11bbe73f85e1e8862f0b5576a14a1b5bb5997bf23e33dc8af6320cbc36
This commit is contained in:
commit
3fcbb0b67d
@ -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<String>) -> Result<Vec<Arg>, Box<dyn Error>> {
|
||||
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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user