Document modules

This commit is contained in:
João M. Bezerra 2021-10-03 00:17:57 -03:00
parent 7178ae84ff
commit 89d1e6a752
9 changed files with 35 additions and 3 deletions

View File

@ -1,3 +1,7 @@
//! CLI argparser configuration, command detection and input treatment.
//!
//! NOTE: the argparser implementation itself is not in this file.
use std::{
env,
ffi::OsString,

View File

@ -1,3 +1,7 @@
//! Core of the crate, where the `compress_files` and `decompress_file` functions are implemented
//!
//! Also, where correctly call functions based on the detected `Command`.
use std::{
fs,
io::{self, BufReader, BufWriter, Read, Write},

View File

@ -1,3 +1,8 @@
//! Pretty (and colored) dialog for asking [Y/n] for the end user.
//!
//! Example:
//! "Do you want to overwrite 'archive.targz'? [Y/n]"
use std::{
borrow::Cow,
io::{self, Write},
@ -38,7 +43,7 @@ impl<'a> Confirmation<'a> {
match trimmed_answer.to_ascii_lowercase().as_ref() {
"y" | "yes" => return Ok(true),
"n" | "no" => return Ok(false),
_ => {}
_ => continue, // Try again
}
}
}

View File

@ -1,3 +1,11 @@
//! Error type definitions.
//!
//! All the unexpected user-side errors should be treated in this file, that does not include
//! errors made by devs in our implementation.
//!
//! TODO: wrap `FinalError` in a variant to keep all `FinalError::display_and_crash()` function
//! calls inside of this module.
use std::{
fmt::{self, Display},
path::{Path, PathBuf},

View File

@ -1,6 +1,8 @@
//! Our representation of all the supported compression formats.
use std::{fmt, path::Path};
use CompressionFormat::*;
use self::CompressionFormat::*;
#[derive(Clone, PartialEq, Eq, Debug)]
/// Accepted extensions for input and output

View File

@ -1,3 +1,9 @@
//! This library is meant to be published, just used internally by our binary crate at `main.rs`.
//!
//! A module shall be public only if:
//! 1. It's required by `main.rs`, or
//! 2. It's required by some integration tests at tests/ folder.
// Public modules
pub mod cli;
pub mod commands;

View File

@ -2,7 +2,6 @@ use crate::NO_COLOR_IS_SET;
#[macro_export]
macro_rules! info {
($writer:expr, $($arg:tt)*) => {
use crate::macros::_info_helper;
_info_helper();

View File

@ -1,3 +1,5 @@
//! Errors related to argparsing.
use std::{error, ffi::OsString, fmt};
use super::Flag;

View File

@ -1,3 +1,5 @@
//! Files in common between one or more integration tests
#![allow(dead_code)]
use std::{