mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
Turning oof
subcrate into a module
This commit is contained in:
parent
5a2028b117
commit
57a3d231eb
@ -21,9 +21,6 @@ tar = "0.4.33"
|
||||
xz2 = "0.1.6"
|
||||
zip = "0.5.11"
|
||||
|
||||
# Dependency from workspace
|
||||
oof = { path = "./oof" }
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3.7"
|
||||
rand = { version = "0.8.3", default-features = false, features = ["small_rng", "std"] }
|
||||
@ -32,9 +29,3 @@ rand = { version = "0.8.3", default-features = false, features = ["small_rng", "
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
opt-level = 3
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
"oof",
|
||||
]
|
||||
|
@ -1,9 +0,0 @@
|
||||
[package]
|
||||
name = "oof"
|
||||
version = "0.1.0"
|
||||
authors = ["João M. Bezerra <marcospb19@hotmail.com>"]
|
||||
edition = "2018"
|
||||
description = "Ouch's argparsing library"
|
||||
repository = "https://github.com/vrmiguel/ouch"
|
||||
|
||||
[dependencies]
|
@ -5,9 +5,10 @@ use std::{
|
||||
vec::Vec,
|
||||
};
|
||||
|
||||
use oof::{arg_flag, flag};
|
||||
use strsim::normalized_damerau_levenshtein;
|
||||
|
||||
use crate::{arg_flag, flag, oof};
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum Command {
|
||||
/// Files to be compressed
|
||||
|
@ -19,7 +19,7 @@ use crate::{
|
||||
dialogs::Confirmation,
|
||||
extension::{CompressionFormat, Extension},
|
||||
file::File,
|
||||
utils,
|
||||
oof, utils,
|
||||
};
|
||||
|
||||
pub fn run(command: Command, flags: &oof::Flags) -> crate::Result<()> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::file::File;
|
||||
use crate::{file::File, oof};
|
||||
|
||||
pub enum DecompressionResult {
|
||||
FilesUnpacked(Vec<PathBuf>),
|
||||
|
@ -8,7 +8,7 @@ use tar::{self, Archive};
|
||||
use utils::colors;
|
||||
|
||||
use super::decompressor::{DecompressionResult, Decompressor};
|
||||
use crate::{dialogs::Confirmation, file::File, utils};
|
||||
use crate::{dialogs::Confirmation, file::File, oof, utils};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TarDecompressor;
|
||||
|
@ -6,7 +6,7 @@ use std::{
|
||||
use utils::colors;
|
||||
|
||||
use super::decompressor::{DecompressionResult, Decompressor};
|
||||
use crate::{extension::CompressionFormat, file::File, utils};
|
||||
use crate::{extension::CompressionFormat, file::File, oof, utils};
|
||||
|
||||
struct DecompressorToMemory;
|
||||
pub struct GzipDecompressor;
|
||||
|
@ -8,7 +8,7 @@ use utils::colors;
|
||||
use zip::{self, read::ZipFile, ZipArchive};
|
||||
|
||||
use super::decompressor::{DecompressionResult, Decompressor};
|
||||
use crate::{dialogs::Confirmation, file::File, utils};
|
||||
use crate::{dialogs::Confirmation, file::File, oof, utils};
|
||||
|
||||
#[cfg(unix)]
|
||||
fn __unix_set_permissions(file_path: &Path, file: &ZipFile) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{fmt, path::PathBuf};
|
||||
|
||||
use crate::utils::colors;
|
||||
use crate::{oof, utils::colors};
|
||||
|
||||
pub enum Error {
|
||||
UnknownExtensionError(String),
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Public modules
|
||||
pub mod cli;
|
||||
pub mod commands;
|
||||
pub mod oof;
|
||||
|
||||
// Private modules
|
||||
mod compressors;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::{error, ffi::OsString, fmt};
|
||||
|
||||
use crate::Flag;
|
||||
use super::Flag;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum OofError {
|
@ -217,7 +217,7 @@ where
|
||||
mod tests {
|
||||
use std::os::unix::prelude::OsStringExt;
|
||||
|
||||
use crate::*;
|
||||
use super::*;
|
||||
|
||||
fn gen_args(text: &str) -> Vec<OsString> {
|
||||
let args = text.split_whitespace();
|
@ -5,7 +5,7 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use crate::{dialogs::Confirmation, extension::CompressionFormat, file::File};
|
||||
use crate::{dialogs::Confirmation, extension::CompressionFormat, file::File, oof};
|
||||
|
||||
#[macro_export]
|
||||
#[cfg(debug_assertions)]
|
||||
|
@ -4,7 +4,7 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use ouch::{cli::Command, commands::run};
|
||||
use ouch::{cli::Command, commands::run, oof};
|
||||
use rand::{rngs::SmallRng, RngCore, SeedableRng};
|
||||
use tempdir::TempDir;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user