diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2020-07-03 09:26:20 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2020-07-03 12:40:16 +0800 |
commit | ce5ee2bf1b3571f6e2bd14996ecc78f364794d22 (patch) | |
tree | a3e627f102f9816f671c33ae8773f50dfc9b8735 | |
parent | e6b15fe1c658ad0577ee933ef5d6e34a8cea6b74 (diff) |
Fix sub-command 'gist pin'
-rwxr-xr-x | gist | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -65,7 +65,7 @@ declare -r CONFIG=~/.config/gist.conf; mkdir -p ~/.config | |||
65 | declare -r per_page=100 | 65 | declare -r per_page=100 |
66 | 66 | ||
67 | declare -ar INDEX_FORMAT=('index' 'public' 'gist_id' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') | 67 | declare -ar INDEX_FORMAT=('index' 'public' 'gist_id' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') |
68 | declare -ar VALID_CONFIGS=('user' 'token' 'folder' 'auto_sync' 'action' 'EDITOR' 'protocol' 'show_untagged') | 68 | declare -ar VALID_CONFIGS=('user' 'token' 'folder' 'auto_sync' 'action' 'EDITOR' 'protocol' 'show_untagged' 'pin') |
69 | declare -A CONFIG_VALUES | 69 | declare -A CONFIG_VALUES |
70 | CONFIG_VALUES[auto_sync]='true|false' | 70 | CONFIG_VALUES[auto_sync]='true|false' |
71 | CONFIG_VALUES[protocol]='https|ssh' | 71 | CONFIG_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 |