From 71170ba96ad788726af419edd64d58bdfe5b52b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 10 Dec 2025 12:19:17 +0100 Subject: Format and add guix install --- utils/ask | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 utils/ask (limited to 'utils/ask') diff --git a/utils/ask b/utils/ask new file mode 100644 index 0000000..4b47c7e --- /dev/null +++ b/utils/ask @@ -0,0 +1,24 @@ +# vim: ft=sh + +# Ask if given section should be installed +# First argument is name (take care not to use special characters for regulard +# expression) and second argument is a question +ask() { + local ignore_file + ignore_file=".ignore-$(hostname)" + [ -f "$ignore_file" ] && grep -q "^$1$" "$ignore_file" && return 1 + if $FORCE; then + echo "\e[1;34m$2\e[0m" + # Fall trough with 0 exit (always yes) + else + echo -e -n "\e[1;34m$2? (Y/n) \e[0m" + local reply + read -r reply + echo "$reply" | grep -qE '^[Yy]?$' + fi +} + +# Check if command is available +hascmd() { + command -v "$1" >/dev/null 2>&1 +} -- cgit v1.2.3