aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2020-07-03 09:26:20 +0800
committerHsieh Chin Fan <typebrook@gmail.com>2020-07-03 12:40:16 +0800
commitce5ee2bf1b3571f6e2bd14996ecc78f364794d22 (patch)
treea3e627f102f9816f671c33ae8773f50dfc9b8735
parente6b15fe1c658ad0577ee933ef5d6e34a8cea6b74 (diff)
Fix sub-command 'gist pin'
-rwxr-xr-xgist4
1 files changed, 2 insertions, 2 deletions
diff --git a/gist b/gist
index 7910439..34158f2 100755
--- a/gist
+++ b/gist
@@ -65,7 +65,7 @@ declare -r CONFIG=~/.config/gist.conf; mkdir -p ~/.config
65declare -r per_page=100 65declare -r per_page=100
66 66
67declare -ar INDEX_FORMAT=('index' 'public' 'gist_id' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') 67declare -ar INDEX_FORMAT=('index' 'public' 'gist_id' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description')
68declare -ar VALID_CONFIGS=('user' 'token' 'folder' 'auto_sync' 'action' 'EDITOR' 'protocol' 'show_untagged') 68declare -ar VALID_CONFIGS=('user' 'token' 'folder' 'auto_sync' 'action' 'EDITOR' 'protocol' 'show_untagged' 'pin')
69declare -A CONFIG_VALUES 69declare -A CONFIG_VALUES
70CONFIG_VALUES[auto_sync]='true|false' 70CONFIG_VALUES[auto_sync]='true|false'
71CONFIG_VALUES[protocol]='https|ssh' 71CONFIG_VALUES[protocol]='https|ssh'
@@ -222,7 +222,7 @@ _reformat_config() {
222 local value="${!key}"; local valid_values=${CONFIG_VALUES[$key]} 222 local value="${!key}"; local valid_values=${CONFIG_VALUES[$key]}
223 if [[ -n "$value" ]] && [[ -z $valid_values || "$value" =~ ^($valid_values)$ ]]; then 223 if [[ -n "$value" ]] && [[ -z $valid_values || "$value" =~ ^($valid_values)$ ]]; then
224 echo -n $key="'$value'" 224 echo -n $key="'$value'"
225 declare -g $key=$value # apply current value 225 declare -g $key="$value" # apply current value
226 else 226 else
227 echo -n $key= 227 echo -n $key=
228 declare -g $key=${valid_values%%|*} # apply the first valid value 228 declare -g $key=${valid_values%%|*} # apply the first valid value