[PATCH 4/9] dim: use ${1:?$usage} for create-workdir argument checking
Jani Nikula
jani.nikula at intel.com
Thu Mar 29 08:45:56 UTC 2018
The benefit of ${1:?$usage} is two-fold. First, it allows enabling of
set -u without errors about unbound variable references. Second, it
provides a uniform error message about missing arguments.
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
dim | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/dim b/dim
index 2496703aac7f..b41beca7301b 100755
--- a/dim
+++ b/dim
@@ -1602,19 +1602,16 @@ function prep_pull_mail
function dim_create_workdir
{
- local branches
+ local branch branches
- cd $DIM_PREFIX
+ branches=${1:?$usage}
- if [[ "x$1" = "x" ]]; then
- echo "usage: $dim $subcommand branch|all"
- exit 1
- elif [[ "$1" = "all" ]] ; then
+ if [[ "$branches" = "all" ]]; then
branches=$dim_branches
- else
- branches=$1
fi
+ cd $DIM_PREFIX
+
for branch in $branches ; do
if [[ -d $branch ]] ; then
continue;
--
2.11.0
More information about the dim-tools
mailing list