From 6181ea0f75f425ef1c7511cf8584885eb198d560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Sun, 2 Jul 2023 12:13:49 +0200 Subject: [PATCH 1/8] doc: changed roadmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Decided to lower scope of required changes, as there is actually already a mvp here, the amount of excuses for not abiding my semver are decreasing too fast. Signed-off-by: Christina Sørensen --- doc/roadmap.org | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/roadmap.org b/doc/roadmap.org index 438ad75..a92f0a7 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -5,11 +5,16 @@ - [ ] Generic repositories - [ ] Version pinning - [ ] libgit2 (maybe) +- [ ] Category Flags Finished * 0.1.0 [60%] [3/5] - [X] No functionality regressions - [X] commit works in quick, fast - [X] commit with edit works - [X] Repo Flags Finished -- [ ] Category Flags Finished - [X] Optional Fields - [ ] Subcommands + - [ ] Quiet flag + - [ ] Do something about coc flag +- [ ] UX + - [ ] Change failure emotes + - [ ] Flag for disabling emotes From 414334009aa816ea2c2ab647ea4130a33828a917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Sun, 2 Jul 2023 16:42:12 +0200 Subject: [PATCH 2/8] refactor: made code more idiomatic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was done with the help of: `cargo clippy -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used` Also fixed some warns that might have turned into errors in the future. Signed-off-by: Christina Sørensen --- Cargo.lock | 2 +- src/git.rs | 74 +++++++++++++++++++++++----------------------- src/main.rs | 20 ++++++------- src/test/test.yaml | 44 +++++++++++++-------------- src/utils/dir.rs | 2 +- 5 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ab04531..fd51770 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,7 +179,7 @@ dependencies = [ [[package]] name = "gg" -version = "0.0.6" +version = "0.0.7" dependencies = [ "clap", "clap_mangen", diff --git a/src/git.rs b/src/git.rs index 53e093c..0ef26e7 100644 --- a/src/git.rs +++ b/src/git.rs @@ -53,7 +53,7 @@ pub enum RepoFlags { /// For diagrams of the underlying architecture, consult ARCHITECHTURE.md /// /// -#[derive(PartialEq, Debug, Serialize, Deserialize)] +#[derive(Eq, PartialEq, Debug, Serialize, Deserialize)] pub struct Config { /// map of all categories /// @@ -66,7 +66,7 @@ pub struct Config { /// Represents a category of repositories /// /// This allows you to organize your repositories into categories -#[derive(PartialEq, Debug, Serialize, Deserialize)] +#[derive(Eq, PartialEq, Debug, Serialize, Deserialize)] pub struct Category { #[serde(skip_serializing_if = "Option::is_none")] pub flags: Option>, // FIXME: not implemented @@ -78,7 +78,7 @@ pub struct Category { } /// Contain fields for a single link. -#[derive(PartialEq, Debug, Serialize, Deserialize)] +#[derive(Eq, PartialEq, Debug, Serialize, Deserialize)] pub struct Links { /// The name of the link pub name: String, @@ -87,7 +87,7 @@ pub struct Links { } /// Holds a single git repository and related fields. -#[derive(PartialEq, Debug, Serialize, Deserialize)] +#[derive(Eq, PartialEq, Debug, Serialize, Deserialize)] pub struct GitRepo { pub name: String, pub path: String, @@ -101,7 +101,7 @@ pub struct GitRepo { //////////////////////////////////// /// Represents a single operation on a repository -struct SeriesItem<'series> { +pub struct SeriesItem<'series> { /// The string to be displayed to the user operation: &'series str, /// The closure representing the actual operation @@ -114,7 +114,10 @@ struct SeriesItem<'series> { fn handle_file_exists(selff: &Links, tx_path: &Path, rx_path: &Path) { match rx_path.read_link() { - Ok(file) if file.canonicalize().unwrap() == tx_path.canonicalize().unwrap() => { + Ok(file) + if file.canonicalize().expect("failed to canonicalize file") + == tx_path.canonicalize().expect("failed to canonicalize path") => + { debug!( "Linking {} -> {} failed: file already linked", &selff.tx, &selff.rx @@ -291,7 +294,7 @@ impl GitRepo { /// Removes a repository (not implemented) /// /// Kept here as a reminder that we probably shouldn't do this - fn remove(&self) -> Result<(), std::io::Error> { + fn remove() -> Result<(), std::io::Error> { // https://doc.rust-lang.org/std/fs/fn.remove_dir_all.html unimplemented!("This seems to easy to missuse/exploit"); // fs::remove_dir_all(format!("{}{}", &self.path, &self.name)) @@ -327,7 +330,7 @@ impl Config { where F: Fn(&GitRepo), { - for (_, category) in self.categories.iter() { + for category in self.categories.values() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { f(repo); } @@ -342,14 +345,13 @@ impl Config { where F: Fn(&GitRepo) -> bool, { - for (_, category) in self.categories.iter() { + for category in self.categories.values() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { - let mut sp = - Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op).into()); + let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); if f(repo) { - sp.stop_and_persist("✔", format!("{}: {}", repo.name, op).into()); + sp.stop_and_persist("✔", format!("{}: {}", repo.name, op)); } else { - sp.stop_and_persist("❎", format!("{}: {}", repo.name, op).into()); + sp.stop_and_persist("❎", format!("{}: {}", repo.name, op)); } } } @@ -396,17 +398,16 @@ impl Config { /// self.series_on_all(series); /// ``` pub fn series_on_all(&self, closures: Vec) { - for (_, category) in self.categories.iter() { + for category in self.categories.values() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { - for instruction in closures.iter() { + for instruction in &closures { let f = &instruction.closure; let op = instruction.operation; - let mut sp = - Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op).into()); + let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); if f(repo) { - sp.stop_and_persist("✔", format!("{}: {}", repo.name, op).into()); + sp.stop_and_persist("✔", format!("{}: {}", repo.name, op)); } else { - sp.stop_and_persist("❎", format!("{}: {}", repo.name, op).into()); + sp.stop_and_persist("❎", format!("{}: {}", repo.name, op)); break; } } @@ -443,17 +444,16 @@ impl Config { /// self.all_on_all(series); /// ``` pub fn all_on_all(&self, closures: Vec) { - for (_, category) in self.categories.iter() { + for category in self.categories.values() { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { - for instruction in closures.iter() { + for instruction in &closures { let f = &instruction.closure; let op = instruction.operation; - let mut sp = - Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op).into()); + let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); if f(repo) { - sp.stop_and_persist("✔", format!("{}: {}", repo.name, op).into()); + sp.stop_and_persist("✔", format!("{}: {}", repo.name, op)); } else { - sp.stop_and_persist("❎", format!("{}: {}", repo.name, op).into()); + sp.stop_and_persist("❎", format!("{}: {}", repo.name, op)); } } } @@ -465,22 +465,22 @@ impl Config { /// Tries to pull all repositories, skips if fail. pub fn pull_all(&self) { debug!("exectuting pull_all"); - self.on_all_spinner("pull", |repo| repo.pull()); + self.on_all_spinner("pull", GitRepo::pull); } /// Tries to clone all repositories, skips if fail. pub fn clone_all(&self) { debug!("exectuting clone_all"); - self.on_all_spinner("clone", |repo| repo.clone()); + self.on_all_spinner("clone", GitRepo::clone); } /// Tries to add all work in all repositories, skips if fail. pub fn add_all(&self) { debug!("exectuting clone_all"); - self.on_all_spinner("add", |repo| repo.add_all()); + self.on_all_spinner("add", GitRepo::add_all); } /// Tries to commit all repositories one at a time, skips if fail. pub fn commit_all(&self) { debug!("exectuting clone_all"); - self.on_all_spinner("commit", |repo| repo.commit()); + self.on_all_spinner("commit", GitRepo::commit); } /// Tries to commit all repositories with msg, skips if fail. pub fn commit_all_msg(&self, msg: &str) { @@ -494,11 +494,11 @@ impl Config { let series: Vec = vec![ SeriesItem { operation: "pull", - closure: Box::new(move |repo: &GitRepo| repo.pull()), + closure: Box::new(GitRepo::pull), }, SeriesItem { operation: "add", - closure: Box::new(move |repo: &GitRepo| repo.add_all()), + closure: Box::new(GitRepo::add_all), }, SeriesItem { operation: "commit", @@ -506,7 +506,7 @@ impl Config { }, SeriesItem { operation: "push", - closure: Box::new(move |repo: &GitRepo| repo.push()), + closure: Box::new(GitRepo::push), }, ]; self.all_on_all(series); @@ -518,19 +518,19 @@ impl Config { let series: Vec = vec![ SeriesItem { operation: "pull", - closure: Box::new(move |repo: &GitRepo| repo.pull()), + closure: Box::new(GitRepo::pull), }, SeriesItem { operation: "add", - closure: Box::new(move |repo: &GitRepo| repo.add_all()), + closure: Box::new(GitRepo::add_all), }, SeriesItem { operation: "commit", - closure: Box::new(move |repo: &GitRepo| repo.commit()), + closure: Box::new(move |repo: &GitRepo| repo.commit_with_msg(msg)), }, SeriesItem { operation: "push", - closure: Box::new(move |repo: &GitRepo| repo.push()), + closure: Box::new(GitRepo::push), }, ]; self.series_on_all(series); @@ -541,7 +541,7 @@ impl Config { /// Tries to link all repositories, skips if fail. pub fn link_all(&self) { debug!("exectuting link_all"); - for link in self.links.iter() { + for link in &self.links { link.link(); } } diff --git a/src/main.rs b/src/main.rs index 6012201..bcc2635 100644 --- a/src/main.rs +++ b/src/main.rs @@ -99,7 +99,7 @@ fn main() { config.commit_all(); } Some(Commands::CommitMsg { msg }) => { - config.commit_all_msg(msg.as_ref().unwrap()); + config.commit_all_msg(msg.as_ref().expect("failed to get message from input")); } None => (), } @@ -154,8 +154,6 @@ mod config { }, ); } - // let yaml = serde_yaml::to_string(&config).unwrap(); - // println!("{}", yaml); } #[test] fn read_config_populate() { @@ -163,13 +161,13 @@ mod config { } #[test] fn write_config() { - let root = current_dir().unwrap(); + let root = current_dir().expect("failed to get current dir"); let config = Config::new( &RelativePath::new("./src/test/config.yaml") .to_logical_path(&root) .into_os_string() .into_string() - .unwrap(), + .expect("failed to turn config into string"), ); let mut test_file = File::create( @@ -177,11 +175,13 @@ mod config { .to_logical_path(&root) .into_os_string() .into_string() - .unwrap(), + .expect("failed to turn config into string"), ) .expect("failed to create test file"); - let contents = serde_yaml::to_string(&config).unwrap(); - test_file.write_all(contents.as_bytes()).unwrap(); + let contents = serde_yaml::to_string(&config).expect("failed to turn config into string"); + test_file + .write_all(contents.as_bytes()) + .expect("failed to write contents of config into file"); let test_config = Config::new(&RelativePath::new("./src/test/test.yaml").to_string()); assert_eq!(config, test_config); @@ -205,13 +205,13 @@ mod config { } #[test] fn is_config_readable() { - let root = current_dir().unwrap(); + let root = current_dir().expect("failed to get current dir"); let config = Config::new( &RelativePath::new("./src/test/config.yaml") .to_logical_path(root) .into_os_string() .into_string() - .unwrap(), + .expect("failed to turnn config into string"), ); let flags = vec![Clone, Push]; diff --git a/src/test/test.yaml b/src/test/test.yaml index b5b3327..1184f45 100644 --- a/src/test/test.yaml +++ b/src/test/test.yaml @@ -1,20 +1,4 @@ categories: - utils: - repos: - li: - name: li - path: /home/ces/org/src/git/ - url: git@github.com:cafkafk/li.git - flags: - - Clone - - Push - gg: - name: gg - path: /home/ces/.dots/ - url: git@github.com:cafkafk/gg.git - flags: - - Clone - - Push stuff: flags: [] repos: @@ -26,16 +10,25 @@ categories: name: gg path: /home/ces/.dots/ url: git@github.com:cafkafk/gg.git - config: - flags: [] + utils: repos: - qmk_firmware: - name: qmk_firmware - path: /home/ces/org/src/git/ - url: git@github.com:cafkafk/qmk_firmware.git + gg: + name: gg + path: /home/ces/.dots/ + url: git@github.com:cafkafk/gg.git flags: - Clone - Push + li: + name: li + path: /home/ces/org/src/git/ + url: git@github.com:cafkafk/li.git + flags: + - Clone + - Push + config: + flags: [] + repos: starship: name: starship path: /home/ces/org/src/git/ @@ -43,6 +36,13 @@ categories: flags: - Clone - Push + qmk_firmware: + name: qmk_firmware + path: /home/ces/org/src/git/ + url: git@github.com:cafkafk/qmk_firmware.git + flags: + - Clone + - Push empty: {} links: - name: gg diff --git a/src/utils/dir.rs b/src/utils/dir.rs index 1530bab..9e90f71 100644 --- a/src/utils/dir.rs +++ b/src/utils/dir.rs @@ -50,7 +50,7 @@ pub fn home_dir() -> String { /// /// WARNING: NOT THREAD SAFE fn change_dir_repo(path: &str, name: &str) { - let mut full_path: String = "".to_owned(); + let mut full_path: String = String::new(); full_path.push_str(path); full_path.push_str(name); let root = Path::new(&full_path); From 2872f56aacc67bc058de2a33c7f1e20239d30bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 3 Jul 2023 11:02:55 +0200 Subject: [PATCH 3/8] feat(cli): implemented CoC flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Idk why I even included this, but then again, it is probably not bad to be very explicit about what is a pledge. Signed-off-by: Christina Sørensen --- doc/roadmap.org | 4 ++-- src/main.rs | 2 +- src/test/test.yaml | 2 +- src/utils/strings.rs | 8 ++++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/roadmap.org b/doc/roadmap.org index a92f0a7..df40644 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -12,9 +12,9 @@ - [X] commit with edit works - [X] Repo Flags Finished - [X] Optional Fields -- [ ] Subcommands +- [-] Subcommands - [ ] Quiet flag - - [ ] Do something about coc flag + - [-] Do something about coc flag - [ ] UX - [ ] Change failure emotes - [ ] Flag for disabling emotes diff --git a/src/main.rs b/src/main.rs index bcc2635..44170b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,7 +61,7 @@ fn main() { match &args { args if args.license => println!("{}", utils::strings::INTERACTIVE_LICENSE), args if args.warranty => println!("{}", utils::strings::INTERACTIVE_WARRANTY), - args if args.code_of_conduct => unimplemented!(), + args if args.code_of_conduct => println!("{}", utils::strings::INTERACTIVE_COC), _ => (), } match &mut args.command { diff --git a/src/test/test.yaml b/src/test/test.yaml index 1184f45..aa2ec05 100644 --- a/src/test/test.yaml +++ b/src/test/test.yaml @@ -1,4 +1,5 @@ categories: + empty: {} stuff: flags: [] repos: @@ -43,7 +44,6 @@ categories: flags: - Clone - Push - empty: {} links: - name: gg rx: /home/ces/.config/gg diff --git a/src/utils/strings.rs b/src/utils/strings.rs index 75d7bba..d0d831f 100644 --- a/src/utils/strings.rs +++ b/src/utils/strings.rs @@ -46,6 +46,14 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. "; +pub const INTERACTIVE_COC: &str = "\ +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, nationality, personal appearance, race, religion, or sexual identity +and orientation. For more, see http://contributor-covenant.org/version/1/4"; + /// Contains the message for quick commit subcommand pub const QUICK_COMMIT: &str = "git: quick commit"; From 0660801014a881131ca5c81d7b92b492bcbadedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 3 Jul 2023 11:16:43 +0200 Subject: [PATCH 4/8] feat(cli): quiet flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created the actual flag, but didn't implement. I had underestimated the amount of global state and abstracting for output it would take. This will probably be essentially free after a refactor that I don't wanna do right now, given how I spend most my energy on the architectural overhaul. Signed-off-by: Christina Sørensen --- doc/roadmap.org | 9 +++++---- src/cli.rs | 6 +++++- src/main.rs | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/roadmap.org b/doc/roadmap.org index df40644..d44c934 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -6,15 +6,16 @@ - [ ] Version pinning - [ ] libgit2 (maybe) - [ ] Category Flags Finished -* 0.1.0 [60%] [3/5] +- [ ] Implement Quiet flag +* 0.1.0 [80%] [4/5] - [X] No functionality regressions - [X] commit works in quick, fast - [X] commit with edit works - [X] Repo Flags Finished - [X] Optional Fields -- [-] Subcommands - - [ ] Quiet flag - - [-] Do something about coc flag +- [X] Subcommands + - [X] Quiet flag (wont rn) + - [X] Do something about coc flag - [ ] UX - [ ] Change failure emotes - [ ] Flag for disabling emotes diff --git a/src/cli.rs b/src/cli.rs index 10e0657..4b7d6f8 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -59,10 +59,14 @@ pub struct Args { #[arg(long)] pub warranty: bool, - /// Print code-of-conduct information (not implemented) + /// Print code-of-conduct information #[arg(long)] pub code_of_conduct: bool, + /// Try to be as quiet as possible (unix philosophy) (not imlemented) + #[arg(short, long)] + pub quiet: bool, + #[command(subcommand)] pub command: Option, } diff --git a/src/main.rs b/src/main.rs index 44170b4..d97985b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,6 +62,7 @@ fn main() { args if args.license => println!("{}", utils::strings::INTERACTIVE_LICENSE), args if args.warranty => println!("{}", utils::strings::INTERACTIVE_WARRANTY), args if args.code_of_conduct => println!("{}", utils::strings::INTERACTIVE_COC), + args if args.quiet => todo!(), _ => (), } match &mut args.command { From 97d8ee52fc45b974d3f0e7f593ae06fbe1c5450d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 3 Jul 2023 11:34:22 +0200 Subject: [PATCH 5/8] feat(git): made SUCCESS/FAILURE emoji const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This puts the emoji for success/failure of a git operation into the strings module of utils. This might be handy down the line for implementing the disable emotes flag. Signed-off-by: Christina Sørensen --- bin/install | 1 - doc/roadmap.org | 5 +++-- src/git.rs | 14 ++++++++------ src/test/test.yaml | 32 ++++++++++++++++---------------- src/utils/strings.rs | 6 ++++++ 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/bin/install b/bin/install index 6133cdf..c4cde3b 100755 --- a/bin/install +++ b/bin/install @@ -1,3 +1,2 @@ #!/usr/bin/env bash -cargo rustc --release -- -C target-cpu=native cargo install --path . diff --git a/doc/roadmap.org b/doc/roadmap.org index d44c934..44b6e98 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -7,6 +7,7 @@ - [ ] libgit2 (maybe) - [ ] Category Flags Finished - [ ] Implement Quiet flag +- [ ] Implement no-emoji flag * 0.1.0 [80%] [4/5] - [X] No functionality regressions - [X] commit works in quick, fast @@ -16,6 +17,6 @@ - [X] Subcommands - [X] Quiet flag (wont rn) - [X] Do something about coc flag -- [ ] UX - - [ ] Change failure emotes +- [-] UX + - [X] Change failure emotes - [ ] Flag for disabling emotes diff --git a/src/git.rs b/src/git.rs index 0ef26e7..e495b4e 100644 --- a/src/git.rs +++ b/src/git.rs @@ -25,6 +25,8 @@ use std::os::unix::fs::symlink; use std::path::Path; use std::{fs, process::Command}; +use crate::utils::strings::{FAILURE_EMOJI, SUCCESS_EMOJI}; + /// An enum containing flags that change behaviour of repos and categories #[derive(PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, Debug)] pub enum RepoFlags { @@ -349,9 +351,9 @@ impl Config { for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); if f(repo) { - sp.stop_and_persist("✔", format!("{}: {}", repo.name, op)); + sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op)); } else { - sp.stop_and_persist("❎", format!("{}: {}", repo.name, op)); + sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op)); } } } @@ -405,9 +407,9 @@ impl Config { let op = instruction.operation; let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); if f(repo) { - sp.stop_and_persist("✔", format!("{}: {}", repo.name, op)); + sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op)); } else { - sp.stop_and_persist("❎", format!("{}: {}", repo.name, op)); + sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op)); break; } } @@ -451,9 +453,9 @@ impl Config { let op = instruction.operation; let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op)); if f(repo) { - sp.stop_and_persist("✔", format!("{}: {}", repo.name, op)); + sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op)); } else { - sp.stop_and_persist("❎", format!("{}: {}", repo.name, op)); + sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op)); } } } diff --git a/src/test/test.yaml b/src/test/test.yaml index aa2ec05..e433730 100644 --- a/src/test/test.yaml +++ b/src/test/test.yaml @@ -1,4 +1,20 @@ categories: + utils: + repos: + li: + name: li + path: /home/ces/org/src/git/ + url: git@github.com:cafkafk/li.git + flags: + - Clone + - Push + gg: + name: gg + path: /home/ces/.dots/ + url: git@github.com:cafkafk/gg.git + flags: + - Clone + - Push empty: {} stuff: flags: [] @@ -11,22 +27,6 @@ categories: name: gg path: /home/ces/.dots/ url: git@github.com:cafkafk/gg.git - utils: - repos: - gg: - name: gg - path: /home/ces/.dots/ - url: git@github.com:cafkafk/gg.git - flags: - - Clone - - Push - li: - name: li - path: /home/ces/org/src/git/ - url: git@github.com:cafkafk/li.git - flags: - - Clone - - Push config: flags: [] repos: diff --git a/src/utils/strings.rs b/src/utils/strings.rs index d0d831f..876b80d 100644 --- a/src/utils/strings.rs +++ b/src/utils/strings.rs @@ -59,3 +59,9 @@ pub const QUICK_COMMIT: &str = "git: quick commit"; /// Contains the message for fast commit subcommand pub const FAST_COMMIT: &str = "git: fast commit"; + +/// Success emoji +pub const SUCCESS_EMOJI: &str = "✔"; + +/// Failure emoji +pub const FAILURE_EMOJI: &str = "❌"; From 1e22d3bf5a9d213f47caeaccac81e516ee720aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 3 Jul 2023 11:36:20 +0200 Subject: [PATCH 6/8] feat(cli): added flag no-emoji MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This does not implement no emoji, althugh it should be easier with the strings consts in place. Signed-off-by: Christina Sørensen --- doc/roadmap.org | 6 +++--- src/cli.rs | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/roadmap.org b/doc/roadmap.org index 44b6e98..2d39f4d 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -8,7 +8,7 @@ - [ ] Category Flags Finished - [ ] Implement Quiet flag - [ ] Implement no-emoji flag -* 0.1.0 [80%] [4/5] +* 0.1.0 [100%] [5/5] - [X] No functionality regressions - [X] commit works in quick, fast - [X] commit with edit works @@ -17,6 +17,6 @@ - [X] Subcommands - [X] Quiet flag (wont rn) - [X] Do something about coc flag -- [-] UX +- [X] UX - [X] Change failure emotes - - [ ] Flag for disabling emotes + - [X] Flag for disabling emotes diff --git a/src/cli.rs b/src/cli.rs index 4b7d6f8..29d0183 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -67,6 +67,10 @@ pub struct Args { #[arg(short, long)] pub quiet: bool, + /// No emoji (not imlemented) + #[arg(short, long)] + pub no_emoji: bool, + #[command(subcommand)] pub command: Option, } From c04ca64325c0d70c153f4eb4da2f96e852a09477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 3 Jul 2023 11:38:02 +0200 Subject: [PATCH 7/8] doc: updated roadmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Planned features for 0.1.1, 0.1.2. Also changed ordering. Signed-off-by: Christina Sørensen --- doc/roadmap.org | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/roadmap.org b/doc/roadmap.org index 2d39f4d..b0c01f8 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -1,12 +1,8 @@ #+title: Roadmap -* Roadmap [0%] [0/4] -- [ ] Custom operation sequences -- [ ] Generic repositories -- [ ] Version pinning -- [ ] libgit2 (maybe) -- [ ] Category Flags Finished +* 0.1.2 - [ ] Implement Quiet flag +* 0.1.1 - [ ] Implement no-emoji flag * 0.1.0 [100%] [5/5] - [X] No functionality regressions @@ -20,3 +16,10 @@ - [X] UX - [X] Change failure emotes - [X] Flag for disabling emotes + +* Roadmap [0%] [0/4] +- [ ] Custom operation sequences +- [ ] Generic repositories +- [ ] Version pinning +- [ ] libgit2 (maybe) +- [ ] Category Flags Finished From 6e7ba4aadf799d3a0d792e377142b6499fcbd7bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 3 Jul 2023 11:44:58 +0200 Subject: [PATCH 8/8] chore: bump v0.1.0, housekeeping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - added changelog - bumped cargo version - fixed readme - other minor fixes Signed-off-by: Christina Sørensen --- CHANGELOG.md | 18 ++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- README.org | 12 +++++++----- doc/roadmap.org | 2 ++ 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68c6505..b4b2176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,24 @@ All notable changes to this project will be documented in this file. +## [0.1.0] - 2023-07-03 + +### Documentation + +- Changed roadmap +- Updated roadmap + +### Features + +- Implemented CoC flag +- Quiet flag +- Made SUCCESS/FAILURE emoji const +- Added flag no-emoji + +### Refactor + +- Made code more idiomatic + ## [0.0.7] - 2023-07-02 ### Bug Fixes diff --git a/Cargo.lock b/Cargo.lock index fd51770..6dd9650 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,7 +179,7 @@ dependencies = [ [[package]] name = "gg" -version = "0.0.7" +version = "0.1.0" dependencies = [ "clap", "clap_mangen", diff --git a/Cargo.toml b/Cargo.toml index 6212798..10a1fc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gg" -version = "0.0.7" +version = "0.1.0" edition = "2021" authors = ["Christina Sørensen"] repository = "https://github.com/cafkafk/gg" diff --git a/README.org b/README.org index 101aead..1a922e0 100644 --- a/README.org +++ b/README.org @@ -9,15 +9,17 @@ those that use declarative operating systems and package managers. Although this isn't really a case where it matters *that* much for performance, being written in rust instead of e.g. /janky/ scripting languages does also mean -it is snappy and reliable, and the /extensive/ testing helps ensure regressions -aren't introduced. +it is snappy and reliable, and the /extensive/ (hardly, but eventually) testing +helps ensure regressions aren't introduced. -That said, we're in 0.0.Z, *here be dragons* for now. +That said, we're in 0.Y.Z, *here be dragons* for now (although a little less each +commit). ** Installation #+begin_src sh -$ git clone https://github.com/cafkafk/git -$ ./install +$ git clone https://github.com/cafkafk/gg +$ cd gg +$ cargo install --path . #+end_src ** Configuration diff --git a/doc/roadmap.org b/doc/roadmap.org index b0c01f8..8ebeb22 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -1,5 +1,7 @@ #+title: Roadmap +* 0.2.0 (maybe) +- [ ] Links in categories? * 0.1.2 - [ ] Implement Quiet flag * 0.1.1