git-{clear,clear-soft,sync}: improve yes/no prompts

Don't print trailing newline; prompt for yes/no response on the same line
This commit is contained in:
Richard Fearn 2016-11-19 16:39:00 +00:00
parent 1ed75978a9
commit 82d6a7265f
3 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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