From 57d2e794004b29323aba845b3a726b2808ff4bbb Mon Sep 17 00:00:00 2001 From: timvisee Date: Thu, 8 Mar 2018 17:49:01 +0100 Subject: [PATCH] Extract application facts into module --- src/app.rs | 11 +++++++++++ src/main.rs | 22 ++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 src/app.rs diff --git a/src/app.rs b/src/app.rs new file mode 100644 index 0000000..102b7fe --- /dev/null +++ b/src/app.rs @@ -0,0 +1,11 @@ +/// The application name. +pub const APP_NAME: &'static str = "ffsend"; + +/// The application version. +pub const APP_VERSION: &'static str = "0.1"; + +/// The application author. +pub const APP_AUTHOR: &'static str = "Tim Visee "; + +/// Application about information. +pub const APP_ABOUT: &'static str = "A simple Firefox Send CLI client."; diff --git a/src/main.rs b/src/main.rs index 4656853..2b1dfa2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,7 @@ extern crate reqwest; #[macro_use] extern crate serde_derive; +mod app; mod b64; mod crypto; mod metadata; @@ -24,23 +25,24 @@ use reqwest::header::Authorization; use reqwest::mime::APPLICATION_OCTET_STREAM; use reqwest::multipart::Part; +use app::*; use crypto::{derive_auth_key, derive_file_key, derive_meta_key}; use metadata::{Metadata, XFileMetadata}; use reader::EncryptedFileReaderTagged; fn main() { // Handle CLI arguments - let matches = App::new("ffsend") - .version("0.1.0") - .author("Tim Visee ") - .about("A simple Firefox Send CLI client") + let matches = App::new(APP_NAME) + .version(APP_VERSION) + .author(APP_AUTHOR) + .about(APP_ABOUT) .arg(Arg::with_name("file") - .short("f") - .long("file") - .value_name("PATH") - .help("The file to upload") - .required(true) - .multiple(false)) + .short("f") + .long("file") + .value_name("PATH") + .help("The file to upload") + .required(true) + .multiple(false)) .get_matches(); // Get the path