maybe don't depend on regex 0u0;
This commit is contained in:
parent
2c4a8f6a3b
commit
5f36f663fc
3 changed files with 19 additions and 50 deletions
44
Cargo.lock
generated
44
Cargo.lock
generated
|
@ -1,14 +1,5 @@
|
||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
[[package]]
|
|
||||||
name = "aho-corasick"
|
|
||||||
version = "0.7.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
|
@ -258,9 +249,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
|
checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"atty",
|
||||||
"humantime",
|
|
||||||
"log",
|
"log",
|
||||||
"regex",
|
|
||||||
"termcolor",
|
"termcolor",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -427,12 +416,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "humantime"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ident_case"
|
name = "ident_case"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -657,24 +640,6 @@ dependencies = [
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex"
|
|
||||||
version = "1.4.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
|
|
||||||
dependencies = [
|
|
||||||
"aho-corasick",
|
|
||||||
"memchr",
|
|
||||||
"regex-syntax",
|
|
||||||
"thread_local",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-syntax"
|
|
||||||
version = "0.6.22"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
|
@ -769,15 +734,6 @@ dependencies = [
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thread_local"
|
|
||||||
version = "1.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d8208a331e1cb318dd5bd76951d2b8fc48ca38a69f5f4e4af1b6a9f8c6236915"
|
|
||||||
dependencies = [
|
|
||||||
"once_cell",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicase"
|
name = "unicase"
|
||||||
version = "2.6.0"
|
version = "2.6.0"
|
||||||
|
|
|
@ -9,7 +9,6 @@ license = "GPL-3.0-or-later"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
walkdir = "2.3.1"
|
walkdir = "2.3.1"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
env_logger = "0.8.2"
|
|
||||||
smartstring = "0.2.6"
|
smartstring = "0.2.6"
|
||||||
# use git version while waiting on a release incorporating https://github.com/ebassi/xdg-mime-rs/commit/de5a6dd
|
# use git version while waiting on a release incorporating https://github.com/ebassi/xdg-mime-rs/commit/de5a6dd
|
||||||
xdg-mime = {git = "https://github.com/ebassi/xdg-mime-rs", version = "0.3"}
|
xdg-mime = {git = "https://github.com/ebassi/xdg-mime-rs", version = "0.3"}
|
||||||
|
@ -20,3 +19,11 @@ cached = "0.23.0"
|
||||||
[dependencies.clap]
|
[dependencies.clap]
|
||||||
version = "3.0.0-beta.2"
|
version = "3.0.0-beta.2"
|
||||||
features = ["wrap_help"]
|
features = ["wrap_help"]
|
||||||
|
|
||||||
|
[dependencies.env_logger]
|
||||||
|
version = "0.8.2"
|
||||||
|
default-features = false
|
||||||
|
features = ["termcolor", "atty"]
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = "thin"
|
16
src/main.rs
16
src/main.rs
|
@ -19,11 +19,11 @@ mod inspectors;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use walkdir::{WalkDir, DirEntry};
|
use walkdir::{WalkDir, DirEntry};
|
||||||
|
use mime_guess::Mime;
|
||||||
use smartstring::alias::String;
|
use smartstring::alias::String;
|
||||||
use clap::Clap;
|
use clap::Clap;
|
||||||
use log::{debug, info, warn, error};
|
use log::{debug, trace, info, warn, error};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use mime_guess::Mime;
|
|
||||||
|
|
||||||
struct Findings {
|
struct Findings {
|
||||||
file: PathBuf,
|
file: PathBuf,
|
||||||
|
@ -84,9 +84,15 @@ fn extension_from_path(path: &Path) -> Option<String> {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = parameters::Parameters::parse();
|
let args = parameters::Parameters::parse();
|
||||||
env_logger::init();
|
let mut builder = env_logger::Builder::from_default_env();
|
||||||
|
builder
|
||||||
|
// .format(|buf, r| writeln!(buf, "{} - {}", r.level(), r.args()))
|
||||||
|
.format_module_path(false)
|
||||||
|
.format_timestamp(None)
|
||||||
|
.init();
|
||||||
|
|
||||||
let db = xdg_mime::SharedMimeInfo::new();
|
let db = xdg_mime::SharedMimeInfo::new();
|
||||||
debug!("=====\nIterating directory: {:?}\n=====", args.dirs);
|
debug!("Iterating directory: {:?}", args.dirs);
|
||||||
|
|
||||||
let stepper = WalkDir::new(&args.dirs).into_iter();
|
let stepper = WalkDir::new(&args.dirs).into_iter();
|
||||||
let entries: Vec<DirEntry> = stepper
|
let entries: Vec<DirEntry> = stepper
|
||||||
|
@ -142,7 +148,7 @@ fn main() {
|
||||||
|
|
||||||
for result in results {
|
for result in results {
|
||||||
match result {
|
match result {
|
||||||
Ok(r) => info!("{:#?}: {:#?} - {:?} - {:?}", r.file, r.mime, r.valid, r.recommended_extension()),
|
Ok(r) => trace!("{:#?}: {:#?} - {:?} - {:?}", r.file, r.mime, r.valid, r.recommended_extension()),
|
||||||
Err(f) => warn!("{:#?}: Error 0uo", f)
|
Err(f) => warn!("{:#?}: Error 0uo", f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue