From 77ae8e8c75caed1cb0fa6a103102a23f4536665e Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 6 Jun 2024 15:11:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Remove=20prompt=20message=20for?= =?UTF-8?q?=20pushing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit semver: patch --- .env/COMMITTER_CHANGELOG | 6 ++++++ .env/COMMITTER_IS_NEW | 2 +- .env/COMMITTER_TAG | 1 + Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 2 +- src/prompt/push.rs | 23 +++++------------------ 7 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 .env/COMMITTER_TAG diff --git a/.env/COMMITTER_CHANGELOG b/.env/COMMITTER_CHANGELOG index e69de29..45bb23b 100644 --- a/.env/COMMITTER_CHANGELOG +++ b/.env/COMMITTER_CHANGELOG @@ -0,0 +1,6 @@ +## 🚀 New features +- ✨ Prompt to push + +## 🩹 Fixes +- 🐛 Add write permission to CD + diff --git a/.env/COMMITTER_IS_NEW b/.env/COMMITTER_IS_NEW index 02e4a84..f32a580 100644 --- a/.env/COMMITTER_IS_NEW +++ b/.env/COMMITTER_IS_NEW @@ -1 +1 @@ -false \ No newline at end of file +true \ No newline at end of file diff --git a/.env/COMMITTER_TAG b/.env/COMMITTER_TAG new file mode 100644 index 0000000..8adc70f --- /dev/null +++ b/.env/COMMITTER_TAG @@ -0,0 +1 @@ +0.8.0 \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index f92b39c..6ce8757 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,7 +49,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "committer" -version = "0.7.1" +version = "0.8.0" dependencies = [ "anyhow", "inquire", diff --git a/Cargo.toml b/Cargo.toml index 17ab63d..c345708 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "committer" -version = "0.7.1" +version = "0.8.0" edition = "2021" description = "A simple git commit message generator" license = "MIT" diff --git a/src/main.rs b/src/main.rs index 17311ea..ebaa772 100644 --- a/src/main.rs +++ b/src/main.rs @@ -117,7 +117,7 @@ fn commit() -> anyhow::Result<()> { crate::git::commit::commit(message)?; - let wants_to_push = crate::prompt::push::prompt(&status)?; + let wants_to_push = crate::prompt::push::prompt()?; if wants_to_push { crate::git::push::push()?; } diff --git a/src/prompt/push.rs b/src/prompt/push.rs index a79c030..963b983 100644 --- a/src/prompt/push.rs +++ b/src/prompt/push.rs @@ -1,22 +1,9 @@ use anyhow::anyhow; use anyhow::Result; -use crate::git::status::Status; - -pub fn prompt(status: &Status) -> Result { - inquire::Confirm::new( - format!( - "You are ahead by {} {}. Do you want to push to the remote?", - status.commits_ahead, - if status.commits_ahead == 1 { - "commit" - } else { - "commits" - } - ) - .as_str(), - ) - .with_default(true) - .prompt() - .map_err(|e| anyhow!(e)) +pub fn prompt() -> Result { + inquire::Confirm::new("Push to the remote?") + .with_default(true) + .prompt() + .map_err(|e| anyhow!(e)) }