1
0
mirror of https://github.com/jht5945/prettyjson.git synced 2025-12-27 17:20:05 +08:00

modify Options

This commit is contained in:
2019-08-31 15:15:45 +08:00
parent 49aa103bfd
commit 76d02be03c
2 changed files with 7 additions and 2 deletions

View File

@@ -31,8 +31,7 @@ Written by Hatter Jiang
fn main() { fn main() {
let mut options = Options::new(); let options = Options::parse_args_static();
options.parse_args();
if options.verbose { if options.verbose {
print_message(MessageType::DEBUG, &format!("{} version: {}, git hash: {}", NAME, VERSION, GIT_HASH)); print_message(MessageType::DEBUG, &format!("{} version: {}, git hash: {}", NAME, VERSION, GIT_HASH));

View File

@@ -20,6 +20,12 @@ impl Options {
} }
} }
pub fn parse_args_static() -> Options {
let mut opt = Options::new();
opt.parse_args();
opt
}
pub fn parse_args(&mut self) { pub fn parse_args(&mut self) {
let mut ap = ArgumentParser::new(); let mut ap = ArgumentParser::new();
ap.set_description("prettyjson - command line JSON pretty tool."); ap.set_description("prettyjson - command line JSON pretty tool.");