Skip to content

Commit

Permalink
Added into {array variable name} for json get api.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Dec 13, 2011
1 parent 091941f commit 528e90e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
17 changes: 16 additions & 1 deletion core/internal/shell/json/functions
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__sm.json.get()
{
typeset _type _path _default _variable _json_file
typeset _type _path _default _variable _json_file _array_name
_json_file="$1" && shift

# TODO: support 'as {variable name}'
Expand All @@ -13,6 +13,11 @@ __sm.json.get()
_type="$1" && shift
_path="$1" && shift
case "${_type}" in
(into)
_array_name="${_path}"
typeset -ga ${_array_name}

;;
(string)
while :
do
Expand Down Expand Up @@ -44,6 +49,11 @@ __sm.json.get()
then
eval "${_variable}=\"${_default}\""
fi

if [[ -n "${_array_name}" ]]
then
eval "${_array_name}+=(${_variable} \${${_variable}})"
fi
;;
(array)
while :
Expand Down Expand Up @@ -76,6 +86,11 @@ __sm.json.get()
then
eval "${_variable}=(${_default})"
fi

if [[ -n "${_array_name}" ]]
then
eval "${_array_name}+=(${_variable} \${${_variable}})"
fi
;;
esac
done
Expand Down
4 changes: 2 additions & 2 deletions core/internal/shell/vcs/detection/functions
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ is_archive_uri()
_uri="${1:-}"
(( $# )) && shift || fail "uri must be given as first parameter."
case "${_uri}" in
*.tar*|*.tgz*|*.txz*|*.tbz2*|*.xz*|*.bz2*|*.gz*|*.zip*|*.lzma*|*github.com/*/*ball/*)
(*.tar*|*.tgz*|*.txz*|*.tbz2*|*.xz*|*.bz2*|*.gz*|*.zip*|*.lzma*|*github.com/*/*ball/*)
return 0
;;
*)
(*)
return 1
;;
esac
Expand Down
3 changes: 1 addition & 2 deletions core/internal/shell/vcs/functions
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ fetch_uri()

if [[ -z "${scm_type}" ]]
then
if ! fetch_uri_detect_scm_type "${_uri}" \
|| [[ -n "${__vcs_failed}" ]]
if ! fetch_uri_detect_scm_type "${_uri}" || [[ -n "${__vcs_failed}" ]]
then
fetch_error unknown_scm "uri=${_uri}"
return $?
Expand Down

0 comments on commit 528e90e

Please sign in to comment.