diff options
author | typebrook <typebrook@gmail.com> | 2020-02-05 01:11:40 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-02-05 01:11:40 +0800 |
commit | 38f95948671f22d33bb4e34e66a456d0407ec051 (patch) | |
tree | 980071f8f111c8be45902348d03aa74df32523ae | |
parent | 1e9d9eb46bc161b455f33ef7ca2fa40f737c80e3 (diff) |
update
-rwxr-xr-x | scripts/gist | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/gist b/scripts/gist index 4662c99..d56b735 100755 --- a/scripts/gist +++ b/scripts/gist | |||
@@ -31,9 +31,8 @@ | |||
31 | 31 | ||
32 | # TODO grep mode for description, file content | 32 | # TODO grep mode for description, file content |
33 | # TODO push github.com (may need new token) | 33 | # TODO push github.com (may need new token) |
34 | # TODO description for current directory | ||
35 | # TODO unit test | 34 | # TODO unit test |
36 | # TODO test on mac and remote machine | 35 | # TODO test on bats, mac and remote machine |
37 | # TODO completion | 36 | # TODO completion |
38 | 37 | ||
39 | # Shell configuration | 38 | # Shell configuration |
@@ -47,19 +46,20 @@ configuredClient="" | |||
47 | 46 | ||
48 | # handle configuration cases | 47 | # handle configuration cases |
49 | _configure() { | 48 | _configure() { |
50 | local target="" | ||
51 | [[ -z "$@" ]] && (${EDITOR:-vi} $CONFIG) && return 0 | 49 | [[ -z "$@" ]] && (${EDITOR:-vi} $CONFIG) && return 0 |
50 | |||
51 | local target="" | ||
52 | if [[ $1 == 'token' ]]; then | 52 | if [[ $1 == 'token' ]]; then |
53 | [[ ${#2} -eq 40 ]] && target=$1=$2 \ | 53 | [[ ${#2} -eq 40 ]] && target=$1=$2 \ |
54 | || echo -e Invalid token format, it is not 40 chars '\n' > /dev/tty | 54 | || echo -e Invalid token format, it is not 40 chars '\n' > /dev/tty |
55 | elif [[ $1 == 'auto_sync' ]]; then | 55 | elif [[ $1 == 'auto_sync' ]]; then |
56 | [[ $2 == 'false' ]] && target=$1=$2 \ | 56 | [[ $2 == 'false' ]] && target=$1=$2 |
57 | || target=$1=true | ||
58 | elif [[ $1 == 'folder' ]]; then | 57 | elif [[ $1 == 'folder' ]]; then |
59 | [[ -n "$2" ]] && target=$1=$2 \ | 58 | [[ -n "$2" ]] && target=$1=$2 |
60 | || target=$1=~/gist | ||
61 | elif [[ $1 == 'user' ]]; then | 59 | elif [[ $1 == 'user' ]]; then |
62 | target=$1=$2 | 60 | target=$1=$2 |
61 | elif [[ $1 == 'action' ]]; then | ||
62 | target=$1="$2" | ||
63 | fi | 63 | fi |
64 | 64 | ||
65 | umask 0077 && touch $CONFIG | 65 | umask 0077 && touch $CONFIG |