mirror of
https://github.com/jht5945/prettyjson.git
synced 2025-12-27 17:20:05 +08:00
modify Options
This commit is contained in:
@@ -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));
|
||||||
|
|||||||
@@ -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.");
|
||||||
|
|||||||
Reference in New Issue
Block a user