From 37867232bdcb373b41bd9b416e3c0f6ab413b477 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 25 May 2020 11:18:27 -0300 Subject: Adds hydractl yaml-param --- share/hydractl/yaml-param | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 share/hydractl/yaml-param (limited to 'share/hydractl/yaml-param') diff --git a/share/hydractl/yaml-param b/share/hydractl/yaml-param new file mode 100755 index 0000000..1ace6c2 --- /dev/null +++ b/share/hydractl/yaml-param @@ -0,0 +1,30 @@ +#!/bin/bash + +# Load. +source $APP_BASE/lib/hydra/functions || exit 1 +hydra_config_load + +# Parameters +BASENAME="`basename $0`" +PARAM="$1" +YAML_FILE="$2" +DEFAULT="$3" + +# Check +if [ -z "$2" ]; then + echo "usage: $BASENAME [default-value]" + exit 1 +elif [ ! -e "$YAML_FILE" ]; then + echo "file not found: $YAML_FILE" + exit 1 +fi + +# Dispatch +PARAM="`hydra_yaml_param $PARAM $YAML_FILE`" + +# Display +if [ ! -z "$PARAM" ]; then + echo "$PARAM" +elif [ ! -z "$DEFAULT" ]; then + echo "$DEFAULT" +fi -- cgit v1.2.3