From 9fcfb29abcf681c2e62513ed237b21c7020a7584 Mon Sep 17 00:00:00 2001 From: "Nikola R. Hristov" Date: Sat, 6 Apr 2024 13:33:39 +0300 Subject: [PATCH] squash! Signed-off-by: Nikola R. Hristov --- .gitignore | 4 +- CHANGELOG.md | 104 ------------------------------ Cargo.toml | 12 ++-- README.md | 22 +++---- Source/Fn/Binary/Command.rs | 6 +- Source/Fn/Binary/Command/Entry.rs | 12 ++-- 6 files changed, 27 insertions(+), 133 deletions(-) diff --git a/.gitignore b/.gitignore index cbb2f71..33f48c4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ Cargo.lock /target/release/* !/target/release/*.deb !/target/release/*.exe -!/target/release/Inn -!/target/release/Innkeeper +!/target/release/PRun +!/target/release/Run diff --git a/CHANGELOG.md b/CHANGELOG.md index 681bb69..43d7b3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,107 +1,3 @@ -## 0.1.9 - -- Cleanup - -## 0.1.8 - -- Cleanup - -## 0.1.7 - -- Cleanup - -## 0.1.6 - -- Cleanup - -## 0.1.5 - -- Cleanup - -## 0.1.4 - -- Cleanup - -## 0.1.3 - -- Cleanup - -## 0.1.2 - -- Cleanup - -## 0.1.1 - -- Cleanup - -## 0.1.0 - -- Cleanup - -## 0.0.17 - -- Add tokio - -## 0.0.16 - -- Cleanup - -## 0.0.15 - -- Add exclude - -## 0.0.14 - -- Cleanup - -## 0.0.13 - -- Cleanup - -## 0.0.12 - -- Cleanup - -## 0.0.11 - -- Cleanup - -## 0.0.10 - -- Cleanup - -## 0.0.9 - -- Cleanup - -## 0.0.8 - -- Cleanup - -## 0.0.7 - -- Cleanup - -## 0.0.6 - -- Wait for input - -## 0.0.5 - -- Adds a file option - -## 0.0.4 - -- Adds parallelism - -## 0.0.3 - -- Cleanup - -## 0.0.2 - -- Cleanup - ## 0.0.1 - Initial version diff --git a/Cargo.toml b/Cargo.toml index b8e9a72..08052b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [[bin]] -name = "Inn" +name = "PRun" path = "Source/Library.rs" [[bin]] -name = "Innkeeper" +name = "Run" path = "Source/Library.rs" [dependencies] @@ -21,10 +21,10 @@ autobenches = false autobins = false autoexamples = false autotests = false -default-run = "Inn" +default-run = "Run" description = "🍺 Run." license = "MIT" -name = "innkeeper" -repository = "https://github.com/NikolaRHristov/Inn.git" -version = "0.1.9" +name = "prun" +repository = "https://github.com/Playform/Run.git" +version = "0.0.1" edition = "2021" diff --git a/README.md b/README.md index e82f52b..81e5bf5 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# 🍺 [Inn] +# 🍺 [Run] -Inn is a command-line tool designed to execute a specified command in all +`Run` is a command-line tool designed to execute a specified command in all directories that match a certain pattern within a given root directory. It provides flexibility and efficiency in running commands across multiple directories with customizable patterns. -[Inn]: https://crates.io/crates/innkeeper +[Run]: https://crates.io/crates/prun ## Benchmark @@ -16,7 +16,7 @@ directories with customizable patterns. -
Inn -P .git ls
+
Run -P .git ls
real    0m9.441s
@@ -36,7 +36,7 @@ sys     0m8.937s +8s
-
Inn -P .git git status
+
Run -P .git git status
real    0m24.146s
@@ -56,7 +56,7 @@ sys     0m8.354s +8s
-
Inn -P .git 'git add . && git commit -m "squash!" && git sync'
+
Run -P .git 'git add . && git commit -m "squash!" && git sync'
real    0m33.813s
@@ -80,13 +80,13 @@ sys     0m14.442s +14s
## Installation ```sh -cargo install innkeeper +cargo install prun ``` ## Usage ```sh -Inn .git git fetch upstream +Run .git git fetch upstream ``` This command will fetch from `upstream` for all the `.git` repositories inside @@ -100,21 +100,21 @@ To specify a `--File` argument or `-F`, if you would like to search for a file instead of a directory, use: ```sh -Inn -F astro.config.ts npx astro add @playform/compress +Run -F astro.config.ts npx astro add @playform/compress ``` Additionally, you can provide a `--Root` argument or `-R` to set the current working directory to a different folder. The default is `.`. ```sh -Inn -R D:\Developer .git git fetch upstream +Run -R D:\Developer .git git fetch upstream ``` Specify a `--Parallel` argument or `-P` if you would like to run commands in parallel. The default is sequential. ```sh -Inn -P -R D:\Developer .git git fetch upstream +Run -P -R D:\Developer .git git fetch upstream ``` ## Dependencies diff --git a/Source/Fn/Binary/Command.rs b/Source/Fn/Binary/Command.rs index 044a52f..4236297 100644 --- a/Source/Fn/Binary/Command.rs +++ b/Source/Fn/Binary/Command.rs @@ -3,10 +3,10 @@ pub mod Parallel; pub mod Sequential; pub fn Fn() -> ArgMatches { - Command::new("Inn") + Command::new("Run") .version(env!("CARGO_PKG_VERSION")) - .author("Nikola R. Hristov ") - .about("Run a command in all directories having a certain pattern.") + .author("Playform ") + .about("🍺 Run.") .arg( Arg::new("File") .short('F') diff --git a/Source/Fn/Binary/Command/Entry.rs b/Source/Fn/Binary/Command/Entry.rs index 20ad657..7b413bb 100644 --- a/Source/Fn/Binary/Command/Entry.rs +++ b/Source/Fn/Binary/Command/Entry.rs @@ -1,21 +1,19 @@ pub fn Fn(Option { Exclude, File, Pattern, Root, Separator, .. }: &Option) -> Return { WalkDir::new(Root) + .follow_links(false) .into_iter() .filter_map(|Entry| { let Path = Entry.expect("Cannot Entry.").path().display().to_string(); - println!("{}", Path); - // TODO: Separate this into Entry/Exclude.rs if !Exclude.clone().into_iter().filter(|Exclude| *Pattern != *Exclude).any(|Exclude| { let Match = Path.contains(&Exclude); match File { - true => { - std::fs::metadata(std::path::PathBuf::from(&Path)) - .expect("Cannot Metadata.") - .is_dir() && Match - } + true => match std::fs::metadata(std::path::PathBuf::from(&Path)) { + Ok(Metadata) => Metadata.is_dir() && Match, + Err(_Error) => false, + }, false => Match, } }) {