mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
Document modules
This commit is contained in:
parent
7178ae84ff
commit
89d1e6a752
@ -1,3 +1,7 @@
|
|||||||
|
//! CLI argparser configuration, command detection and input treatment.
|
||||||
|
//!
|
||||||
|
//! NOTE: the argparser implementation itself is not in this file.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
|
@ -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::{
|
use std::{
|
||||||
fs,
|
fs,
|
||||||
io::{self, BufReader, BufWriter, Read, Write},
|
io::{self, BufReader, BufWriter, Read, Write},
|
||||||
|
@ -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::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
io::{self, Write},
|
io::{self, Write},
|
||||||
@ -38,7 +43,7 @@ impl<'a> Confirmation<'a> {
|
|||||||
match trimmed_answer.to_ascii_lowercase().as_ref() {
|
match trimmed_answer.to_ascii_lowercase().as_ref() {
|
||||||
"y" | "yes" => return Ok(true),
|
"y" | "yes" => return Ok(true),
|
||||||
"n" | "no" => return Ok(false),
|
"n" | "no" => return Ok(false),
|
||||||
_ => {}
|
_ => continue, // Try again
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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::{
|
use std::{
|
||||||
fmt::{self, Display},
|
fmt::{self, Display},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
//! Our representation of all the supported compression formats.
|
||||||
|
|
||||||
use std::{fmt, path::Path};
|
use std::{fmt, path::Path};
|
||||||
|
|
||||||
use CompressionFormat::*;
|
use self::CompressionFormat::*;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
/// Accepted extensions for input and output
|
/// Accepted extensions for input and output
|
||||||
|
@ -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
|
// Public modules
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
pub mod commands;
|
pub mod commands;
|
||||||
|
@ -2,7 +2,6 @@ use crate::NO_COLOR_IS_SET;
|
|||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! info {
|
macro_rules! info {
|
||||||
|
|
||||||
($writer:expr, $($arg:tt)*) => {
|
($writer:expr, $($arg:tt)*) => {
|
||||||
use crate::macros::_info_helper;
|
use crate::macros::_info_helper;
|
||||||
_info_helper();
|
_info_helper();
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! Errors related to argparsing.
|
||||||
|
|
||||||
use std::{error, ffi::OsString, fmt};
|
use std::{error, ffi::OsString, fmt};
|
||||||
|
|
||||||
use super::Flag;
|
use super::Flag;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! Files in common between one or more integration tests
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user