Skip to content

Commit abb40ea

Browse files
committed
README.md changes
1 parent 7a3ad52 commit abb40ea

File tree

5 files changed

+37
-18
lines changed

5 files changed

+37
-18
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.3] - 2023-04-03
9+
10+
### Added
11+
12+
- Added better README.md
13+
814
## [0.0.2] - 2023-04-01
915

1016
### Fixed
@@ -26,5 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2632

2733
- 'None
2834

35+
[0.0.3]: https://github.com/mbrav/git_raider/compare/0.0.2...0.0.3
2936
[0.0.2]: https://github.com/mbrav/git_raider/compare/0.0.1...0.0.2
3037
[0.0.1]: https://github.com/mbrav/git_raider/releases/tag/0.0.1

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "git_raider"
3-
version = "0.0.2"
3+
version = "0.0.3"
44
descripion = "Mass git repository search, replace and commit tool"
55
authors = ["mbrav <mbrav@protonmail.com>"]
66
edition = "2021"

README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@
22
[![License](https://img.shields.io/badge/License-BSD_3--Clause-yellow.svg)](https://opensource.org/licenses/BSD-3-Clause)
33
[![tokei](https://tokei.rs/b1/github/mbrav/git_raider?category=lines)](https://tokei.rs/b1/github/mbrav/git_raider)
44

5-
65
# git_raider
76

87
Mass git repository search, replace and commit tool written in Rust
98

10-
*Description to be added soon*
9+
This cli tool is designed to **recursively** run through a directory (`-p`/`--path` flag) and find the following:
10+
11+
* Folders that contain a *.git* folder (and hence are git repositories);
12+
* A branch name regex pattern specified with the `-b`/`--branch` flag which checks out a branch that was matched by the regex. A warning will be outputted if more than one branch was matched;
13+
* A file name regex pattern specified with the `-f`/`--file` flag. This will match all files that match the regex pattern;
14+
* A regex pattern specified with the `-l`/`--line` flag that will match *a whole* line in a file that was matched by `-f`/`--file`;
15+
* A regex pattern specified with the `-s`/`--select` flag that can match just *a part* of a line selected with `-l`/`--line`;
16+
* A regex pattern specified with the `-r`/`--replace` flag that will replace content selected with `-s`/`--select` flag;
17+
* A commit message specified with the `-m`/`--message`. If this flag is not passed, no commit will be made.
18+
19+
### TODO
20+
21+
For base functionality to be completed, the following must still be finished:
22+
23+
* Create new commit with specified message;
24+
* Make `dry-run` much better;
1125

1226
## Run
1327

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ fn main() {
4343

4444
// Stage matches
4545
raider.stage();
46-
}
4746

48-
// Commit changes with message
49-
if let Some(commit_message) = conf.commit_message {
50-
raider.commit(commit_message.as_str());
47+
// Commit changes with message
48+
if let Some(commit_message) = conf.commit_message {
49+
raider.commit(commit_message.as_str());
50+
}
5151
}
5252

5353
// Print results for found directories, Pages and matches

src/raider.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,26 @@ impl RepoRaider {
9090
}
9191
}
9292

93-
/// Recursively matches for filenames with a specific name and outputs a result vector
93+
/// Recursively matches for filenames with a specific name and generates a result vector
9494
pub fn match_files(&mut self, pattern: &str) {
9595
for dir in &mut self.dirs {
9696
let f: Vec<structs::Page> =
9797
func::find_files(dir.path.to_str().expect("Error unwrapping Path"), pattern)
9898
.iter()
99-
.map(|x| {
100-
structs::Page {
101-
path: x.clone(),
102-
matches: Vec::new(),
103-
relative_path: x
104-
.strip_prefix(&self.path)
105-
.expect("Error prefixing Path")
106-
.to_path_buf(), // dir: Rc::new(dir.clone()),
107-
}
99+
.map(|x| structs::Page {
100+
path: x.clone(),
101+
matches: Vec::new(),
102+
relative_path: x
103+
.strip_prefix(&self.path)
104+
.expect("Error prefixing Path")
105+
.to_path_buf(),
108106
})
109107
.collect();
110108
dir.pages.extend(f);
111109
}
112110
}
113111

114-
/// Recursively searches for a all lines matching a pattern in a file
112+
/// Recursively searches for all lines matching a pattern in a file
115113
/// and saves them as a Match
116114
pub fn match_lines(&mut self, pattern: &str) {
117115
let re = Regex::new(pattern).expect("Error compiling regex");

0 commit comments

Comments
 (0)