dialogs: use `Cow<str>` to avoid cloning a String
[ouch.git] / src / lib.rs
blob58a9879a2abadfad4924896acdf6b9566c158d63
1 // Public modules
2 pub mod cli;
3 pub mod commands;
4 pub mod oof;
6 // Private modules
7 pub mod archive;
8 mod dialogs;
9 mod error;
10 mod extension;
11 mod macros;
12 mod utils;
14 pub use error::{Error, Result};
16 use lazy_static::lazy_static;
18 pub const EXIT_FAILURE: i32 = 127;
20 const VERSION: &str = "0.1.6";
22 lazy_static! {
23     static ref NO_COLOR_IS_SET: bool = {
24         use std::env;
26         env::var("NO_COLOR").is_ok()
27     };
30 fn help_command() {
31     use utils::colors::*;
32     /*
33     ouch - Obvious Unified Compressed files Helper
35     USAGE:
36         ouch <files...>                        Decompresses files.
38         ouch compress <files...> OUTPUT.EXT    Compresses files into OUTPUT.EXT,
39                                                where EXT must be a supported format.
41     FLAGS:
42         -h, --help    Display this help information.
43         -y, --yes     Skip overwrite questions.
44         -n, --no      Skip overwrite questions.
45         --version     Display version information.
47     SPECIFIC FLAGS:
48         -o, --output FOLDER_PATH    When decompressing, to decompress files to
49                                     another folder.
51     Visit https://github.com/vrmiguel/ouch for more usage examples.
52     */
54     println!(
55         "\
56 {cyan}ouch{reset} - Obvious Unified Compression files Helper
58 {cyan}USAGE:{reset}
59     {green}ouch {magenta}<files...>{reset}                        Decompresses files.
61     {green}ouch compress {magenta}<files...> OUTPUT.EXT{reset}    Compresses files into {magenta}OUTPUT.EXT{reset},
62                                            where {magenta}EXT{reset} must be a supported format.
64 {cyan}FLAGS:{reset}
65     {yellow}-h{white}, {yellow}--help{reset}    Display this help information.
66     {yellow}-y{white}, {yellow}--yes{reset}     Skip overwrite questions.
67     {yellow}-n{white}, {yellow}--no{reset}      Skip overwrite questions.
68     {yellow}--version{reset}     Display version information.
70 {cyan}SPECIFIC FLAGS:{reset}
71     {yellow}-o{reset}, {yellow}--output{reset} FOLDER_PATH    When decompressing, to decompress files to
72                                 another folder.
74 Visit https://github.com/vrmiguel/ouch for more usage examples.",
75         magenta = magenta(),
76         white = white(),
77         green = green(),
78         yellow = yellow(),
79         reset = reset(),
80         cyan = cyan()
81     );
84 #[inline]
85 fn version_command() {
86     use utils::colors::*;
87     println!("{green}ouch{reset} {}", crate::VERSION, green = green(), reset = reset());