diff --git a/src/cli.rs b/src/cli.rs index 4ef39ec..cd853de 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,4 +1,6 @@ -//! CLI arg parser configuration, command detection and input treatment. +//! CLI configuration step, uses definitions from `opts.rs`. +//! +//! Also used to treat some inputs. use std::{ path::{Path, PathBuf}, diff --git a/src/extension.rs b/src/extension.rs index 346351f..3cd17d6 100644 --- a/src/extension.rs +++ b/src/extension.rs @@ -21,6 +21,7 @@ pub enum CompressionFormat { } impl CompressionFormat { + /// Currently supported archive formats are .tar (and aliases to it) and .zip pub fn is_archive_format(&self) -> bool { matches!(self, Tar | Tgz | Tbz | Tlzma | Tzst | Zip) } diff --git a/src/lib.rs b/src/lib.rs index 80ca62f..7793a35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,13 +6,15 @@ #![warn(missing_docs)] +// Macros should be declared before +pub mod macros; + pub mod archive; pub mod cli; pub mod commands; pub mod dialogs; pub mod error; pub mod extension; -pub mod macros; pub mod opts; pub mod utils; diff --git a/src/macros.rs b/src/macros.rs index 4a16e8c..5bf7205 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -1,7 +1,7 @@ //! Macros used on ouch. -#[macro_export] /// Macro that prints message in INFO mode +#[macro_export] macro_rules! info { ($($arg:tt)*) => { $crate::macros::_info_helper(); diff --git a/src/opts.rs b/src/opts.rs index 24bc299..75842cc 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -1,7 +1,9 @@ +//! CLI configuration step, uses definitions from `opts.rs`, also used to treat some inputs. use clap::{Parser, ValueHint}; use std::path::PathBuf; +/// Command line options #[derive(Parser, Debug)] #[clap(version, about)] pub struct Opts { @@ -13,10 +15,12 @@ pub struct Opts { #[clap(short, long)] pub no: bool, + /// Action to take #[clap(subcommand)] pub cmd: Subcommand, } +/// Actions to take #[derive(Parser, PartialEq, Eq, Debug)] pub enum Subcommand { /// Compress files. Alias: c