chore: add version flag
This commit is contained in:
parent
2cba234125
commit
08b3c50cac
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -748,7 +748,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cloudmandala"
|
||||
version = "0.1.0"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "cloudmandala"
|
||||
version = "0.1.0"
|
||||
version = "0.1.2"
|
||||
authors = ["JesusPerez <jpl@jesusperez.pro>"]
|
||||
edition = "2018"
|
||||
|
||||
|
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…
Reference in New Issue
Block a user