Don't use global variables
This commit is contained in:
parent
ce3bdfed22
commit
5c4fd5c1c5
12
src/_gist
12
src/_gist
|
|
@ -79,7 +79,7 @@ _gist_read_gists() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# stores the gists of the logged in user in the format ID[Description]
|
# stores the gists of the logged in user in the format ID[Description]
|
||||||
_list=()
|
local list=()
|
||||||
_cached_gists="user_gists"
|
_cached_gists="user_gists"
|
||||||
|
|
||||||
# retrieve/Write gists from/to cache
|
# retrieve/Write gists from/to cache
|
||||||
|
|
@ -97,18 +97,18 @@ _gist_read_gists() {
|
||||||
_retrieve_cache $_cached_gists
|
_retrieve_cache $_cached_gists
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$_gists" ]; then
|
if [[ -n "$_gists" ]]; then
|
||||||
echo "$_gists" | while read -r line; do
|
echo "$_gists" | while read -r line; do
|
||||||
# Splitting the gist -l output
|
# Splitting the gist -l output
|
||||||
url="$(echo "$line" | cut -d " " -f 1 | cut -d "/" -f 4)"
|
local url="$(echo "$line" | cut -d " " -f 1 | cut -d "/" -f 4)"
|
||||||
# gists w/o descriptions can have only one column in the output, those
|
# gists w/o descriptions can have only one column in the output, those
|
||||||
# have their description set to an empty string
|
# have their description set to an empty string
|
||||||
description="$(echo "$line" | awk '{if(NF > 1){$1=""; print $0}}')"
|
local description="$(echo "$line" | awk '{if(NF > 1){$1=""; print $0}}')"
|
||||||
|
|
||||||
_list+=( "${url}[${description}]" )
|
list+=( "${url}[${description}]" )
|
||||||
done
|
done
|
||||||
|
|
||||||
_values "gists" $_list
|
_values "gists" $list
|
||||||
ret=0
|
ret=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue