diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-06-16 22:40:57 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2014-06-16 22:40:57 -0400 |
commit | 3d9850b56c77b51edcdb2697c74ba2d1761109dc (patch) | |
tree | e5fe03bcbf6cd4d72f7c31a3129156e6784c4325 /src/lib/conf.sh | |
parent | 52cc0c3ff27d4c48d3461d9fd898367aa4a92631 (diff) | |
parent | 813bfa255a1e46f05e08dcb587b8f417b995b2d4 (diff) |
Merge branch 'master' into lukeshu/xbs
Diffstat (limited to 'src/lib/conf.sh')
-rw-r--r-- | src/lib/conf.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/conf.sh b/src/lib/conf.sh index 561ae9e..1aa7b56 100644 --- a/src/lib/conf.sh +++ b/src/lib/conf.sh @@ -1,11 +1,13 @@ #!/bin/bash # non-executable, but put this there as a hint to text editors # This may be included with or without `set -euE` -# Copyright (c) 2012-2013 by Luke Shumaker <lukeshu@sbcglobal.net> +# Copyright (C) 2012-2014 Luke Shumaker <lukeshu@sbcglobal.net> +# +# License: GNU GPLv2+ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -122,7 +124,7 @@ load_files() { # Check whether the variables listed are properly set. # If not, it prints a message saying to set them in the configuration file(s) # for $slug. -check_vars() { +check_vars() ( local slug=$1; shift local ret=0 @@ -132,10 +134,10 @@ check_vars() { if [[ -z ${!VAR:-} ]]; then type print &>/dev/null || . libremessages if [[ $(list_files $slug|wc -l) -gt 1 ]]; then - print "Configure '%s' in one of:" "$VAR" + _l print "Configure '%s' in one of:" "$VAR" list_files $slug | sed 's/./ -> &/' else - print "Configure '%s' in '%s'" "$VAR" "$(list_files $slug)" + _l print "Configure '%s' in '%s'" "$VAR" "$(list_files $slug)" fi ret=1 fi @@ -144,7 +146,7 @@ check_vars() { if [[ $ret != 0 ]]; then return 1 fi -} +) # Usage: get_var <slug> <var_name> <default_value> # Does not work with arrays |