diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-06-10 21:20:08 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-06-10 21:58:20 -0400 |
commit | ea91be31180d48b6d19870d3a5470552f9606357 (patch) | |
tree | 0b881c1c23b7dcc04fe24e2ede7e4d296f46c8ec /src/main.rs | |
parent | 11788656767aa6044ed71d212adf0dcde4c5e5d5 (diff) |
Refactor: Config::from_args
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs index 8c48cddb..79a5376e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,8 +57,7 @@ fn main() -> std::io::Result<()> { Err(_) => None, }; - let config = - cli::process_command_line_arguments(cli::Opt::clap().get_matches(), &mut git_config); + let config = config::Config::from_arg_matches(cli::Opt::clap().get_matches(), &mut git_config); if atty::is(atty::Stream::Stdin) { return diff( @@ -191,15 +190,17 @@ index f38589a..0f1bb83 100644 } writeln!(stdout, "\n\nTheme: {}\n", style.paint(syntax_theme))?; - let arg_matches = cli::Opt::clap().get_matches_from(vec![ - "--syntax-theme", - syntax_theme, - "--file-style", - "omit", - "--hunk-header-style", - "omit", - ]); - let config = cli::process_command_line_arguments(arg_matches, &mut None); + let config = config::Config::from_args( + &[ + "--syntax-theme", + syntax_theme, + "--file-style", + "omit", + "--hunk-header-style", + "omit", + ], + &mut None, + ); let mut output_type = OutputType::from_mode(PagingMode::QuitIfOneScreen, None, &config).unwrap(); let mut writer = output_type.handle().unwrap(); |