2
0
mirror of https://github.com/Revertron/Alfis synced 2024-11-15 06:12:52 +00:00

Changed command flag -v to show version and exit. Selection of other log levels will be possible in config in the future.

This commit is contained in:
Revertron 2021-04-17 20:37:20 +02:00
parent bd76b712ad
commit 75125b971b
2 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "alfis"
version = "0.4.8"
version = "0.4.9"
authors = ["Revertron <alfis@revertron.com>"]
edition = "2018"
build = "build.rs"

View File

@ -43,7 +43,7 @@ fn main() {
let mut opts = Options::new();
opts.optflag("h", "help", "Print this help menu");
opts.optflag("n", "nogui", "Run without graphic user interface (default for no gui builds)");
opts.optflag("v", "verbose", "Show more debug messages");
opts.optflag("v", "version", "Print version and exit");
opts.optflag("d", "debug", "Show trace messages, more than debug");
opts.optflag("b", "blocks", "List blocks from DB and exit");
opts.optflag("g", "generate", "Generate new config file. Generated config will be printed to console.");
@ -60,12 +60,17 @@ fn main() {
if opt_matches.opt_present("h") {
let brief = format!("Usage: {} [options]", program);
println!("{}", opts.usage(&brief));
return;
exit(0);
}
if opt_matches.opt_present("v") {
println!("ALFIS v{}", env!("CARGO_PKG_VERSION"));
exit(0);
}
if opt_matches.opt_present("g") {
println!("{}", include_str!("../alfis.toml"));
return;
exit(0);
}
match opt_matches.opt_str("u") {
@ -148,9 +153,6 @@ fn main() {
/// Sets up logger in accordance with command line options
fn setup_logger(opt_matches: &Matches) {
let mut level = LevelFilter::Info;
if opt_matches.opt_present("v") {
level = LevelFilter::Debug;
}
if opt_matches.opt_present("d") {
level = LevelFilter::Trace;
}