feat: output to file
This commit is contained in:
@@ -8,6 +8,7 @@ pub enum PlistFormat {
|
||||
pub struct ParsedArgs {
|
||||
pub in_file: String,
|
||||
pub format: PlistFormat,
|
||||
pub out_file: Option<String>,
|
||||
}
|
||||
|
||||
pub fn parse_args(matches: ArgMatches<'static>) -> ParsedArgs {
|
||||
@@ -18,6 +19,7 @@ pub fn parse_args(matches: ArgMatches<'static>) -> ParsedArgs {
|
||||
Some("bin") | Some("binary") => PlistFormat::Binary,
|
||||
_ => failure_and_exit!("Plist format error."),
|
||||
},
|
||||
out_file: matches.value_of("out").map(ToString::to_string),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +32,8 @@ pub fn get_args_matches() -> ArgMatches<'static> {
|
||||
.default_value("xml")
|
||||
.possible_values(&["xml", "binary", "bin"])
|
||||
.help("Output plist format")
|
||||
).arg(Arg::with_name("FILE").required(true).index(1).help("plist file name"))
|
||||
)
|
||||
.arg(Arg::with_name("out").short("o").long("out").takes_value(true).help("Output plist file"))
|
||||
.arg(Arg::with_name("FILE").required(true).index(1).help("Input plist file name"))
|
||||
.get_matches()
|
||||
}
|
||||
Reference in New Issue
Block a user