1use std::process::Command;
2
3pub fn run() {
4 let status = Command::new("git")
5 .args(get_git_reset_args())
6 .status()
7 .expect("Failed to execute git reset");
8
9 if status.success() {
10 println!("{}", format_success_message());
11 } else {
12 eprintln!("{}", format_error_message());
13 }
14}
15
16pub fn get_git_reset_args() -> [&'static str; 3] {
18 ["reset", "--soft", "HEAD~1"]
19}
20
21pub fn format_success_message() -> &'static str {
23 "Last commit undone (soft reset). Changes kept in working directory."
24}
25
26pub fn format_error_message() -> &'static str {
28 "❌ Failed to undo last commit."
29}