Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
Signed-off-by: Nikola R. Hristov <[email protected]>
  • Loading branch information
NikolaRHristov committed Apr 6, 2024
1 parent 38f9da6 commit 9fcfb29
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 133 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
104 changes: 0 additions & 104 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[[bin]]
name = "Inn"
name = "PRun"
path = "Source/Library.rs"

[[bin]]
name = "Innkeeper"
name = "Run"
path = "Source/Library.rs"

[dependencies]
Expand All @@ -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"
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -16,7 +16,7 @@ directories with customizable patterns.
</tr>
<tr>
<td>
<pre>Inn -P .git ls</pre>
<pre>Run -P .git ls</pre>
</td>
<td>
<pre>real 0m9.441s
Expand All @@ -36,7 +36,7 @@ sys 0m8.937s +8s</pre>
</tr>
<tr>
<td>
<pre>Inn -P .git git status</pre>
<pre>Run -P .git git status</pre>
</td>
<td>
<pre>real 0m24.146s
Expand All @@ -56,7 +56,7 @@ sys 0m8.354s +8s</pre>
</tr>
<tr>
<td>
<pre>Inn -P .git 'git add . && git commit -m "squash!" && git sync'</pre>
<pre>Run -P .git 'git add . && git commit -m "squash!" && git sync'</pre>
</td>
<td>
<pre>real 0m33.813s
Expand All @@ -80,13 +80,13 @@ sys 0m14.442s +14s</pre>
## 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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Source/Fn/Binary/Command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <nikola@playform.cloud>")
.about("Run a command in all directories having a certain pattern.")
.author("Playform <hello@playform.cloud>")
.about("🍺 Run.")
.arg(
Arg::new("File")
.short('F')
Expand Down
12 changes: 5 additions & 7 deletions Source/Fn/Binary/Command/Entry.rs
Original file line number Diff line number Diff line change
@@ -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,
}
}) {
Expand Down

0 comments on commit 9fcfb29

Please sign in to comment.