summaryrefslogtreecommitdiffstats
path: root/nix-utils.sh
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-06-19 19:58:51 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-06-19 20:15:23 +0200
commitf1eac5295cc1d0bde838c7bd807ab3c032ecf620 (patch)
treed880d9f6378e264b3394cacad51cdbde0302db29 /nix-utils.sh
parente75bb174c6d3813354c466d0caf5e5ba79a5aceb (diff)
Add util for asking to execute a command
Diffstat (limited to 'nix-utils.sh')
-rw-r--r--nix-utils.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/nix-utils.sh b/nix-utils.sh
index 35e0098..8f31c5d 100644
--- a/nix-utils.sh
+++ b/nix-utils.sh
@@ -55,6 +55,14 @@ continue_question() {
[[ "${answer}" =~ ^[Yy]$ ]] || return 1
}
+ask_execute() {
+ q="$1"; shift
+ local answer
+ echo -ne "${Yellow}$q${Color_Off} [Yn]? "
+ read answer; echo
+ [[ ! "${answer}" =~ ^[Nn]$ ]] && eval $*
+}
+
__git() {
DIR=$1; shift
explain git --git-dir="$DIR/.git" --work-tree="$DIR" $*