chore: add version flag
This commit is contained in:
parent
2cba234125
commit
08b3c50cac
3 changed files with 14 additions and 2 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -44,6 +44,11 @@ use crate::defs::{BxDynResult};
|
|||
/// The verbosity level when no `-q` or `-v` arguments are given, with `0` being `-q`
|
||||
pub const DEFAULT_VERBOSITY: u64 = 1;
|
||||
|
||||
const PKG_VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||
// const PKG_VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");
|
||||
const PKG_NAME: &'static str = env!("CARGO_PKG_NAME");
|
||||
const PKG_AUTHORS: &'static str = env!("CARGO_PKG_AUTHORS");
|
||||
|
||||
/// Default KEY PATH
|
||||
pub const KEY_PATH: &str = ".k";
|
||||
// Local imports
|
||||
|
|
@ -117,6 +122,13 @@ async fn main() -> std::io::Result<()> { // Result<()> {
|
|||
// }
|
||||
// cmd_main().await;
|
||||
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
// println!("I got {:?} arguments: {:?}.", args.len() - 1, &args[1..]);
|
||||
if args.len() > 1 && args[1] == "-v" {
|
||||
println!("{} version: {}", PKG_NAME,PKG_VERSION);
|
||||
println!("{} authors: {}", PKG_NAME,PKG_AUTHORS);
|
||||
return Ok(());
|
||||
}
|
||||
let web_mode = &envmnt::get_or("WEB_MODE", "");
|
||||
if web_mode == "" {
|
||||
cmd_main().await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue