From 44fb8683b2721ba4cae861f5334f5d803ff93116 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 14 Dec 2019 23:35:52 +0800 Subject: [PATCH] add read config --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index c969713..961fb80 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,10 @@ fn main() -> XResult<()> { return Ok(()); } + if options.verbose { + print_message(MessageType::DEBUG, &format!("Config is: {}", &options.config)); + } + println!("Hello, world!"); println!("{}", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs()); @@ -44,7 +48,13 @@ fn main() -> XResult<()> { // let openpgp_client = OpenPGPTool::from_file("sample.gpg")?; // openpgp_client.encrypt_file("a", "b.asc", true)?; - let config_json = get_config_json(None); // TODO + let config_json = get_config_json(if options.config == "" { None } else { Some(&options.config) }); + if config_json.is_none() { + return Ok(()); + } + + // TODO ... + // let j = config_json.unwrap(); // println!("{}", j);