diff options
| -rw-r--r-- | .gitignore | 7 | ||||
| -rw-r--r-- | rust-cli/grrs/Cargo.toml | 9 | ||||
| -rw-r--r-- | rust-cli/grrs/src/main.rs | 21 | ||||
| -rwxr-xr-x | save.sh | 4 |
4 files changed, 41 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab1c2ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +debug/ +target/ +Cargo.lock +**/*.rs.bk +*.pdb +.vscode +.idea diff --git a/rust-cli/grrs/Cargo.toml b/rust-cli/grrs/Cargo.toml new file mode 100644 index 0000000..08077b2 --- /dev/null +++ b/rust-cli/grrs/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "grrs" +version = "0.1.0" +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +clap = { version = "4.0", features = ["derive"] }
\ No newline at end of file diff --git a/rust-cli/grrs/src/main.rs b/rust-cli/grrs/src/main.rs new file mode 100644 index 0000000..09e2d3a --- /dev/null +++ b/rust-cli/grrs/src/main.rs @@ -0,0 +1,21 @@ +use std::io::{BufReader, BufRead}; +use std::fs::File; +use::clap::Parser; + +#[derive(Parser)] +struct Cli { + pattern: String, + path: std::path::PathBuf, +} + + +fn main() { + let args = Cli::parse(); + //println!("pattern: {}, path: {}",args.pattern, args.path.display()); + let file = File::open(args.path).expect("could not read file"); + let mut reader = BufReader::new(file); + for line in reader.lines() { + if line.unwrap_or_default().contains(&args.pattern) { + } + } +} @@ -0,0 +1,4 @@ +#!/bin/bash +git add . +git commit -m '$(date "+%D %T")' +git push |
