1 // Macros should be declared first
14 /// CLI argparsing definitions, using `clap`.
17 use std::{env, path::PathBuf};
19 use error::{Error, Result};
20 use once_cell::sync::Lazy;
21 use opts::{Opts, Subcommand};
22 use utils::{QuestionAction, QuestionPolicy};
24 // Used in BufReader and BufWriter to perform less syscalls
25 const BUFFER_CAPACITY: usize = 1024 * 32;
27 /// Current directory or empty directory
28 static CURRENT_DIRECTORY: Lazy<PathBuf> = Lazy::new(|| env::current_dir().unwrap_or_default());
30 /// The status code returned from `ouch` on error
31 pub const EXIT_FAILURE: i32 = libc::EXIT_FAILURE;
34 if let Err(err) = run() {
36 std::process::exit(EXIT_FAILURE);
40 fn run() -> Result<()> {
41 let (args, skip_questions_positively, file_visibility_policy) = Opts::parse_args()?;
42 commands::run(args, skip_questions_positively, file_visibility_policy)