Skip to content

Commit

Permalink
Move args into App for wider access
Browse files Browse the repository at this point in the history
  • Loading branch information
djeedai committed Dec 6, 2020
1 parent 6ebe170 commit 0d10587
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/weldr/src/weldr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ trait Action {

struct App<'a, 'b> {
cli: clap::App<'a, 'b>,
args: CliArgs,
}

impl App<'_, '_> {
Expand Down Expand Up @@ -262,13 +263,13 @@ fn main() -> Result<(), Error> {
.map(|()| log::set_max_level(log::LevelFilter::Info))
.unwrap();

let args = CliArgs::from_args();
let app = App {
let mut app = App {
cli: CliArgs::clap(),
args: CliArgs::from_args(),
};

let res = match args.cmd {
Cmd::Convert(mut conv) => conv.exec(),
let res = match &mut app.args.cmd {
Cmd::Convert(conv) => conv.exec(),
};
if let Err(e) = res {
error!("{}", e);
Expand Down

0 comments on commit 0d10587

Please sign in to comment.