From d9726ca29a1e5f903ba1321f537b24154e43e235 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Wed, 1 Jul 2020 23:50:20 +0800 Subject: Reformat usage of pattern --- gist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gist b/gist index f1770a0..594f323 100755 --- a/gist +++ b/gist @@ -157,9 +157,9 @@ _process_json() { _configure() { [[ $# == 0 ]] && ${EDITOR:-vi} $CONFIG && return 0 - local key=$1; local value="$2" - [[ ! " ${VALID_CONFIGS[@]} " =~ " ${key} " ]] \ - && echo "Not a valid key for configuration, use <${VALID_CONFIGS[@]}> instead." \ + local key=$1; local value="$2"; valid_configs=${VALID_CONFIGS[@]} + [[ ! ${key} =~ ^(${valid_configs// /|})$ ]] \ + && echo "Not a valid key for configuration, use <${valid_configs[@]// /|}> instead." \ && return 1 case $key in -- cgit v1.2.3-70-g09d2