diff options
-rwxr-xr-x | gist | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -154,14 +154,13 @@ _configure() { | |||
154 | local valid_keys='user|token|folder|auto_sync|EDITOR|action|protocol' | 154 | local valid_keys='user|token|folder|auto_sync|EDITOR|action|protocol' |
155 | if [[ $1 =~ ^($valid_keys)$ ]]; then | 155 | if [[ $1 =~ ^($valid_keys)$ ]]; then |
156 | if [[ $1 == 'user' ]]; then | 156 | if [[ $1 == 'user' ]]; then |
157 | [[ -z $2 ]] && echo "Must specify username" >&2 && return 1 | 157 | [[ -z $2 ]] && echo 'Must specify username' >&2 && return 1 |
158 | elif [[ $1 == 'token' ]]; then | 158 | elif [[ $1 == 'token' ]]; then |
159 | [[ ${#2} -ne 40 ]] && echo 'Invalid token format, it is not 40 chars' >&2 \ | 159 | [[ ${#2} -ne 40 ]] && echo 'Invalid token format, it is not 40 chars' >&2 && return 1 |
160 | && return 1 | ||
161 | elif [[ $1 == 'auto_sync' ]]; then | 160 | elif [[ $1 == 'auto_sync' ]]; then |
162 | [[ ! $2 =~ ^(true|false)$ ]] && return 1 | 161 | [[ ! $2 =~ ^(true|false)$ ]] && echo 'auto_sync must be either true or false' >&2 && return 1 |
163 | elif [[ $1 == 'protocol' ]]; then | 162 | elif [[ $1 == 'protocol' ]]; then |
164 | [[ ! $2 =~ ^(https|ssh)$ ]] && return 1 | 163 | [[ ! $2 =~ ^(https|ssh)$ ]] && echo 'protocol must be either https or ssh' >&2 && return 1 |
165 | fi | 164 | fi |
166 | local key=$1 && shift && local target=$key="'$*'" | 165 | local key=$1 && shift && local target=$key="'$*'" |
167 | else | 166 | else |