diff options
| author | typebrook <typebrook@gmail.com> | 2020-02-07 18:50:56 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-02-07 18:50:56 +0800 |
| commit | fefb48a4ce734e35348dce4d45c81e6554559e9c (patch) | |
| tree | 2a15952bf1ead1970cde18a848bf2e7003100eec | |
| parent | c742f9f65a4a9c120e300a5c2cac5920127760e5 (diff) | |
update
| -rwxr-xr-x | scripts/gist | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/gist b/scripts/gist index 9420243..5217c53 100755 --- a/scripts/gist +++ b/scripts/gist | |||
| @@ -170,10 +170,11 @@ _show_list() { | |||
| 170 | [[ -z $1 ]] && local filter='/^ *s/ d; /^$/ d' | 170 | [[ -z $1 ]] && local filter='/^ *s/ d; /^$/ d' |
| 171 | [[ $1 == "s" ]] && local filter='/^ *[^ s]/ d; /^$/ d' | 171 | [[ $1 == "s" ]] && local filter='/^ *[^ s]/ d; /^$/ d' |
| 172 | 172 | ||
| 173 | while read index link blob_code file_num extra author description; do | 173 | while read index link blob_code file_num comment_num author description; do |
| 174 | [[ $1 == "s" ]] && local name=$author | 174 | [[ $1 == "s" ]] && local name=$author |
| 175 | local repo=$folder/$(echo $link | sed 's#.*/##') | 175 | local repo=$folder/$(echo $link | sed 's#.*/##') |
| 176 | local occupy=0 | 176 | local occupy=0 |
| 177 | local extra="$file_num $comment_num" | ||
| 177 | 178 | ||
| 178 | # if repo is not yet cloned, show green message "Not cloned yet" | 179 | # if repo is not yet cloned, show green message "Not cloned yet" |
| 179 | [[ ! -d $repo ]] && extra="\e[32m[Not cloned yet]\e[0m" && occupy=16 | 180 | [[ ! -d $repo ]] && extra="\e[32m[Not cloned yet]\e[0m" && occupy=16 |
| @@ -184,7 +185,7 @@ _show_list() { | |||
| 184 | # if there is a commit not yet push, show red message "ahead" | 185 | # if there is a commit not yet push, show red message "ahead" |
| 185 | [[ -n $(cd $repo && git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m" && occupy=7 | 186 | [[ -n $(cd $repo && git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m" && occupy=7 |
| 186 | 187 | ||
| 187 | echo -e "$(printf "% 3s" $index)" $link $name $file_num $extra $(echo $description | cut -c -$(( 60 -$occupy -1 )) ) | 188 | echo -e "$(printf "% 3s" $index)" $link $name $extra $(echo $description | cut -c -$(( 60 -$occupy -1 )) ) |
| 188 | done < $INDEX \ | 189 | done < $INDEX \ |
| 189 | | sed "$filter" | 190 | | sed "$filter" |
| 190 | echo -e '\nrun "gist help" or "gist h" for more details' > /dev/tty | 191 | echo -e '\nrun "gist help" or "gist h" for more details' > /dev/tty |
| @@ -231,6 +232,7 @@ for gist in raw: | |||
| 231 | } | 232 | } |
| 232 | 233 | ||
| 233 | # TODO check if a user has no gist | 234 | # TODO check if a user has no gist |
| 235 | # FIXME replace space with sed | ||
| 234 | # parse response from gists require | 236 | # parse response from gists require |
| 235 | _parse_response() { | 237 | _parse_response() { |
| 236 | AccessJsonElement "$(_handle_gists)" \ | 238 | AccessJsonElement "$(_handle_gists)" \ |