From 96e8f30f162a42ce692012cfcf800087c8b133f6 Mon Sep 17 00:00:00 2001 From: ramiro-l Date: Wed, 3 Jul 2024 12:54:02 -0300 Subject: [PATCH 1/3] fix: Fixed a naming bug and added emoji_skip in sc.toml --- README.md | 5 ++++- sc.toml | 3 ++- src/config/mod.rs | 4 ++-- src/tui/steps/emoji.rs | 2 +- src/tui/steps/exec.rs | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index befe205..a203729 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,10 @@ scopes = ["app", "lib", "docs"] [git] # By default the skip preview flag is setted to false because we know # It's a dangerous action. -skip_preview = true +preview_skip = true + +emoji_skip = true + # Customize your commit template as you want commit_template = ["git", "commit", "-m", "{{message}}", "&&", "git", "push"] ``` diff --git a/sc.toml b/sc.toml index 9750efc..110e2f8 100644 --- a/sc.toml +++ b/sc.toml @@ -8,4 +8,5 @@ scopes = [ ] [git] -skip_preview = false +preview_skip = false +emojis_skip = false diff --git a/src/config/mod.rs b/src/config/mod.rs index ac920ab..3f49777 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -50,11 +50,11 @@ pub struct SimpleCommitsConfig { pub struct GitConfig { /// Confirm before to run git commit #[clap(long, short)] - pub skip_preview: bool, + pub preview_skip: bool, /// Confirm before to run git commit #[clap(long, short)] - pub skip_emojis: bool, + pub emojis_skip: bool, /// Command to run after generate commit message #[clap(long, short)] diff --git a/src/tui/steps/emoji.rs b/src/tui/steps/emoji.rs index 4895e75..9625506 100644 --- a/src/tui/steps/emoji.rs +++ b/src/tui/steps/emoji.rs @@ -13,7 +13,7 @@ impl Step for _Step { if config .git .as_ref() - .is_some_and(|git_cfg| git_cfg.skip_emojis) + .is_some_and(|git_cfg| git_cfg.emojis_skip) { return Ok(()); } diff --git a/src/tui/steps/exec.rs b/src/tui/steps/exec.rs index 51a03e1..bfeb389 100644 --- a/src/tui/steps/exec.rs +++ b/src/tui/steps/exec.rs @@ -39,7 +39,7 @@ impl Step for _Step { let cmd = command .first() .expect("The commit template cannot be empty"); - if git.skip_preview { + if git.preview_skip { state.exec_type = Some(ExecType::Command(cmd.clone(), (command[1..]).to_vec())); return Ok(()); } From 7fb8c82cdd6fc7250248372af47e618844698f69 Mon Sep 17 00:00:00 2001 From: ramiro-l Date: Wed, 3 Jul 2024 13:51:25 -0300 Subject: [PATCH 2/3] fix: The default names were left and the corresponding change was made to fix the error --- README.md | 4 ++-- sc.toml | 4 ++-- src/config/mod.rs | 8 ++++---- src/tui/steps/emoji.rs | 2 +- src/tui/steps/exec.rs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a203729..e7310e7 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,9 @@ scopes = ["app", "lib", "docs"] [git] # By default the skip preview flag is setted to false because we know # It's a dangerous action. -preview_skip = true +skip_preview = true -emoji_skip = true +skip_emoji = true # Customize your commit template as you want commit_template = ["git", "commit", "-m", "{{message}}", "&&", "git", "push"] diff --git a/sc.toml b/sc.toml index 110e2f8..13e7336 100644 --- a/sc.toml +++ b/sc.toml @@ -8,5 +8,5 @@ scopes = [ ] [git] -preview_skip = false -emojis_skip = false +skip_preview = false +skip_emojis = false diff --git a/src/config/mod.rs b/src/config/mod.rs index 3f49777..9b053f3 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -49,12 +49,12 @@ pub struct SimpleCommitsConfig { #[derive(Clone, Default, Serialize, Deserialize, Parser, Merge)] pub struct GitConfig { /// Confirm before to run git commit - #[clap(long, short)] - pub preview_skip: bool, + #[arg(short = 'p', long = "skip-preview")] + pub skip_preview: bool, /// Confirm before to run git commit - #[clap(long, short)] - pub emojis_skip: bool, + #[arg(short = 'e', long = "skip-emojis")] + pub skip_emojis: bool, /// Command to run after generate commit message #[clap(long, short)] diff --git a/src/tui/steps/emoji.rs b/src/tui/steps/emoji.rs index 9625506..4895e75 100644 --- a/src/tui/steps/emoji.rs +++ b/src/tui/steps/emoji.rs @@ -13,7 +13,7 @@ impl Step for _Step { if config .git .as_ref() - .is_some_and(|git_cfg| git_cfg.emojis_skip) + .is_some_and(|git_cfg| git_cfg.skip_emojis) { return Ok(()); } diff --git a/src/tui/steps/exec.rs b/src/tui/steps/exec.rs index bfeb389..51a03e1 100644 --- a/src/tui/steps/exec.rs +++ b/src/tui/steps/exec.rs @@ -39,7 +39,7 @@ impl Step for _Step { let cmd = command .first() .expect("The commit template cannot be empty"); - if git.preview_skip { + if git.skip_preview { state.exec_type = Some(ExecType::Command(cmd.clone(), (command[1..]).to_vec())); return Ok(()); } From 78270fb6893f2eb691532498368a61ef5490db00 Mon Sep 17 00:00:00 2001 From: ramiro-l Date: Wed, 3 Jul 2024 14:39:46 -0300 Subject: [PATCH 3/3] feat: :art: Formatted the readme and added the fields -p to --skip-preview and -e to --skip-emoji --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e7310e7..d86a0aa 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ A little CLI written in rust to improve your dirty commits into **conventional** ones. -## 👀 Demo _(coming soon)_ +## 👀 Demo _(coming soon)_ ## ✨ Features @@ -17,7 +17,6 @@ A little CLI written in rust to improve your dirty commits into **conventional** - Custom templates - Written in rust - ## 📥 Installation _(not available yet)_ Install it using cargo! @@ -26,15 +25,15 @@ Install it using cargo! cargo install simple-commits ``` - ## 🛠 Configuration in your `~/$CONFIG_FOLDER` create a `sc` directory with a `config.toml` inside. -> [!TIP] -> ```bash -> mkdir ~/$CONFIG_FOLDER/sc && touch ~/$CONFIG_FOLDER/sc/config.toml -> ``` +> [!TIP] +> +> ```bash +> mkdir ~/$CONFIG_FOLDER/sc && touch ~/$CONFIG_FOLDER/sc/config.toml +> ``` and use this template to configure it as you want. @@ -52,6 +51,7 @@ skip_emoji = true # Customize your commit template as you want commit_template = ["git", "commit", "-m", "{{message}}", "&&", "git", "push"] ``` + ## 💻 Usage To use it you just need to run one command. 😍 @@ -62,8 +62,9 @@ sc or if you prefer to want to use flags: -| flags | Description | -| ----- | ----------- | -| `-s` \| `--skip-preview` | ⚠️ Skips the preview step (Dangerous) | +| flags | Description | +| --------------------------- | -------------------------------------------- | +| `-p` \| `--skip-preview` | ⚠️ Skips the preview step (Dangerous) | +| `-e` \| `--skip-emoji` | Skips the emoji step | | `-c` \| `--commit-template` | Command to run after generate commit message | -| `--config` | Set the config path | +| `--config` | Set the config path |