small refactor and renamings
[ouch.git] / src / main.rs
blob38c86f0e493e393318cee10ff1b47746013800ce
1 // Macros should be declared first
2 pub mod macros;
4 pub mod archive;
5 pub mod cli;
6 pub mod commands;
7 pub mod error;
8 pub mod extension;
9 pub mod list;
10 pub mod progress;
11 pub mod utils;
13 /// CLI argparsing definitions, using `clap`.
14 pub mod opts;
16 use error::{Error, Result};
17 use opts::{Opts, Subcommand};
18 use utils::{QuestionAction, QuestionPolicy};
20 // Used in BufReader and BufWriter to perform less syscalls
21 const BUFFER_CAPACITY: usize = 1024 * 32;
23 /// The status code returned from `ouch` on error
24 pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE;
26 fn main() {
27     if let Err(err) = run() {
28         eprintln!("{}", err);
29         std::process::exit(EXIT_FAILURE);
30     }
33 fn run() -> Result<()> {
34     let (args, skip_questions_positively, file_visibility_policy) = Opts::parse_args()?;
35     commands::run(args, skip_questions_positively, file_visibility_policy)