From 82d6a7265f1a309e49f6e64da0e8675fd3716437 Mon Sep 17 00:00:00 2001 From: Richard Fearn Date: Sat, 19 Nov 2016 16:39:00 +0000 Subject: [PATCH] git-{clear,clear-soft,sync}: improve yes/no prompts Don't print trailing newline; prompt for yes/no response on the same line --- bin/git-clear | 2 +- bin/git-clear-soft | 2 +- bin/git-sync | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/git-clear b/bin/git-clear index f08819c..52bd14d 100755 --- a/bin/git-clear +++ b/bin/git-clear @@ -1,6 +1,6 @@ #!/usr/bin/env bash -echo "Sure? - This command may delete files that cannot be recovered, including those in .gitignore [y/N]" +echo -n "Sure? - This command may delete files that cannot be recovered, including those in .gitignore [y/N]: " read ans if [ "$ans" == "y" ] then git clean -d -f -x && git reset --hard diff --git a/bin/git-clear-soft b/bin/git-clear-soft index 003416a..8b1542d 100755 --- a/bin/git-clear-soft +++ b/bin/git-clear-soft @@ -1,6 +1,6 @@ #!/usr/bin/env bash -echo "Sure? - This command may delete files that cannot be recovered. Files and directories in .gitignore will be preserved [Y/n]" +echo -n "Sure? - This command may delete files that cannot be recovered. Files and directories in .gitignore will be preserved [Y/n]: " read ans if [ "$ans" != "n" ] then git clean -d -f && git reset --hard diff --git a/bin/git-sync b/bin/git-sync index 8de036a..49fe98f 100755 --- a/bin/git-sync +++ b/bin/git-sync @@ -60,7 +60,7 @@ function main() remote_branch="${remote}/${branch}" fi - echo "Are you sure you want to clean all changes & sync with '${remote_branch}'? [y/N]" + echo -n "Are you sure you want to clean all changes & sync with '${remote_branch}'? [y/N]: " local res read res case "${res}" in