diff --git a/.gitignore b/.gitignore
index a7d3833..e811dce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
/target
/imgs
-./fif_*
+fif_*
/old
+*.sh
diff --git a/.idea/fif.iml b/.idea/fif.iml
index c254557..9ed97f6 100644
--- a/.idea/fif.iml
+++ b/.idea/fif.iml
@@ -4,6 +4,8 @@
+
+
diff --git a/Cargo.lock b/Cargo.lock
index a66db30..2374655 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -9,15 +9,6 @@ dependencies = [
"memchr",
]
-[[package]]
-name = "ansi_term"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
-dependencies = [
- "winapi",
-]
-
[[package]]
name = "arrayvec"
version = "0.5.2"
@@ -35,6 +26,12 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "autocfg"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+
[[package]]
name = "bitflags"
version = "1.2.1"
@@ -55,19 +52,36 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
-version = "2.33.3"
+version = "3.0.0-beta.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
+checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
dependencies = [
- "ansi_term",
"atty",
"bitflags",
+ "clap_derive",
+ "indexmap",
+ "lazy_static",
+ "os_str_bytes",
"strsim",
+ "termcolor",
"textwrap",
"unicode-width",
"vec_map",
]
+[[package]]
+name = "clap_derive"
+version = "3.0.0-beta.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1"
+dependencies = [
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "dirs-next"
version = "2.0.0"
@@ -106,11 +120,11 @@ dependencies = [
name = "fif"
version = "0.1.0"
dependencies = [
+ "clap",
"env_logger",
"log",
"mime_guess",
"smartstring",
- "structopt",
"walkdir",
"xdg-mime",
]
@@ -132,6 +146,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+[[package]]
+name = "hashbrown"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
+
[[package]]
name = "heck"
version = "0.3.2"
@@ -156,6 +176,16 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
+[[package]]
+name = "indexmap"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
[[package]]
name = "lazy_static"
version = "1.4.0"
@@ -229,6 +259,12 @@ version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
+[[package]]
+name = "os_str_bytes"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85"
+
[[package]]
name = "proc-macro-error"
version = "1.0.4"
@@ -340,33 +376,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
-version = "0.8.0"
+version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
-
-[[package]]
-name = "structopt"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c"
-dependencies = [
- "clap",
- "lazy_static",
- "structopt-derive",
-]
-
-[[package]]
-name = "structopt-derive"
-version = "0.4.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90"
-dependencies = [
- "heck",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
@@ -390,9 +402,9 @@ dependencies = [
[[package]]
name = "textwrap"
-version = "0.11.0"
+version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
+checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
dependencies = [
"unicode-width",
]
diff --git a/Cargo.toml b/Cargo.toml
index c990bd3..b461190 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,8 +8,8 @@ license = "GPL-3.0-or-later"
[dependencies]
walkdir = "2.3.1"
-structopt = "0.3.21"
-#clap = "3.0.0-beta.2"
+#structopt = "0.3.21"
+clap = "3.0.0-beta.2"
log = "0.4.14"
env_logger = "0.8.2"
smartstring = "0.2.6"
diff --git a/clippy.sh b/clippy.sh
deleted file mode 100755
index 108452b..0000000
--- a/clippy.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-fd -e rs -x touch {}
-cargo clippy
diff --git a/src/main.rs b/src/main.rs
index 16889af..355f63c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -20,7 +20,8 @@ mod inspectors;
use std::path::{Path};
use walkdir::{WalkDir, DirEntry};
use smartstring::alias::String;
-use structopt::StructOpt;
+// use structopt::StructOpt;
+use clap::Clap;
use log::{info};
// TODO: test if this actually works on a windows machine
@@ -66,7 +67,7 @@ fn wanted_file(args: ¶meters::Parameters, entry: &DirEntry) -> bool {
}
fn main() {
- let args = parameters::Parameters::from_args();
+ let args = parameters::Parameters::parse();
// env_logger::init();
let db = xdg_mime::SharedMimeInfo::new();
println!("{:#?}", args);
diff --git a/src/parameters.rs b/src/parameters.rs
index 28c1877..f9dd638 100644
--- a/src/parameters.rs
+++ b/src/parameters.rs
@@ -1,19 +1,19 @@
-use structopt::StructOpt;
+use clap::Clap;
use std::path::PathBuf;
use smartstring::alias::String;
-#[derive(StructOpt, Debug)]
+#[derive(Clap, Debug)]
pub struct Parameters {
/// Only examine files with these extensions (Comma-separated list)
- #[structopt(short, long, use_delimiter = true)]
+ #[clap(short, long, use_delimiter = true)]
pub extensions: Option>,
/// Don't skip hidden files and directories
- #[structopt(short, long)]
+ #[clap(short, long)]
pub scan_hidden: bool,
/// Directories to process
- #[structopt(name = "DIRS", default_value = ".", parse(from_os_str))]
+ #[clap(name = "DIRS", default_value = ".", parse(from_os_str))]
// dirs: PathBuf
pub dirs: PathBuf,
}