Skip to content

Commit

Permalink
🩹 Remove prompt message for pushing
Browse files Browse the repository at this point in the history
semver: patch
  • Loading branch information
Somfic committed Jun 6, 2024
1 parent 7eebd8f commit 77ae8e8
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 22 deletions.
6 changes: 6 additions & 0 deletions .env/COMMITTER_CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 🚀 New features
- ✨ Prompt to push

## 🩹 Fixes
- 🐛 Add write permission to CD

2 changes: 1 addition & 1 deletion .env/COMMITTER_IS_NEW
Original file line number Diff line number Diff line change
@@ -1 +1 @@
false
true
1 change: 1 addition & 0 deletions .env/COMMITTER_TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.8.0
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
}
Expand Down
23 changes: 5 additions & 18 deletions src/prompt/push.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
use anyhow::anyhow;
use anyhow::Result;

use crate::git::status::Status;

pub fn prompt(status: &Status) -> Result<bool> {
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<bool> {
inquire::Confirm::new("Push to the remote?")
.with_default(true)
.prompt()
.map_err(|e| anyhow!(e))
}

0 comments on commit 77ae8e8

Please sign in to comment.