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:
parent
bd76b712ad
commit
75125b971b
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "alfis"
|
name = "alfis"
|
||||||
version = "0.4.8"
|
version = "0.4.9"
|
||||||
authors = ["Revertron <alfis@revertron.com>"]
|
authors = ["Revertron <alfis@revertron.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
14
src/main.rs
14
src/main.rs
@ -43,7 +43,7 @@ fn main() {
|
|||||||
let mut opts = Options::new();
|
let mut opts = Options::new();
|
||||||
opts.optflag("h", "help", "Print this help menu");
|
opts.optflag("h", "help", "Print this help menu");
|
||||||
opts.optflag("n", "nogui", "Run without graphic user interface (default for no gui builds)");
|
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("d", "debug", "Show trace messages, more than debug");
|
||||||
opts.optflag("b", "blocks", "List blocks from DB and exit");
|
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.");
|
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") {
|
if opt_matches.opt_present("h") {
|
||||||
let brief = format!("Usage: {} [options]", program);
|
let brief = format!("Usage: {} [options]", program);
|
||||||
println!("{}", opts.usage(&brief));
|
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") {
|
if opt_matches.opt_present("g") {
|
||||||
println!("{}", include_str!("../alfis.toml"));
|
println!("{}", include_str!("../alfis.toml"));
|
||||||
return;
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
match opt_matches.opt_str("u") {
|
match opt_matches.opt_str("u") {
|
||||||
@ -148,9 +153,6 @@ fn main() {
|
|||||||
/// Sets up logger in accordance with command line options
|
/// Sets up logger in accordance with command line options
|
||||||
fn setup_logger(opt_matches: &Matches) {
|
fn setup_logger(opt_matches: &Matches) {
|
||||||
let mut level = LevelFilter::Info;
|
let mut level = LevelFilter::Info;
|
||||||
if opt_matches.opt_present("v") {
|
|
||||||
level = LevelFilter::Debug;
|
|
||||||
}
|
|
||||||
if opt_matches.opt_present("d") {
|
if opt_matches.opt_present("d") {
|
||||||
level = LevelFilter::Trace;
|
level = LevelFilter::Trace;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user