summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hydra/misc15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/hydra/misc b/lib/hydra/misc
index b349b40..26d03ea 100644
--- a/lib/hydra/misc
+++ b/lib/hydra/misc
@@ -129,3 +129,18 @@ function hydra_usage_hydra {
function hydra_usage_hydractl {
echo "Usage: hydractl <command> [arguments]"
}
+
+# Read a parameter from user
+function hydra_read {
+ local input
+ param="$1"
+ default="$2"
+ shift 2
+ read -rep "$* (defaults to $default): " input
+
+ if [ -z "$input" ]; then
+ declare $param=$default
+ else
+ declare $param=$input
+ fi
+}