From 3eae3fd496abcd843d18a36e042f2185527d8803 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 11 May 2014 18:36:00 -0700 Subject: a bit more progress on using shred to pick through API results. Commented out because the array storage is kindof weird so the first try (assuming simple arrays) didn't work out. I'll have to rethink how to index these things and may have to rewrite the js() function to do the kinds of things I want. --- util/shred/FriendicaOAuth.sh | 8 ++++---- util/shred/shred | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'util') diff --git a/util/shred/FriendicaOAuth.sh b/util/shred/FriendicaOAuth.sh index 4055e44a9..76858d73c 100755 --- a/util/shred/FriendicaOAuth.sh +++ b/util/shred/FriendicaOAuth.sh @@ -175,10 +175,10 @@ FO_statuses_home_timeline () { FO_command () { local command="$1" - local params=( - $(OAuth_param 'screen_name' $screen_name) - $(OAuth_param 'count' $count) - ) + local params=( + $(OAuth_param 'screen_name' $screen_name) + $(OAuth_param 'count' $count) + ) local auth_header=$(OAuth_authorization_header 'Authorization' "$redmatrix_url" '' '' 'GET' "${redmatrix_url}/api/${command}.json" ${params[@]}) diff --git a/util/shred/shred b/util/shred/shred index c46efa435..9af554032 100755 --- a/util/shred/shred +++ b/util/shred/shred @@ -152,7 +152,9 @@ main () { fcli_in_reply_to_status_id= fcli_file= fcli_help_flag= - while getopts "C:c:s:r:f:h" name + JS_Fields=() + + while getopts "C:c:s:r:f:h:i" name do case $name in c) fcli_command="$OPTARG";; @@ -161,6 +163,7 @@ main () { r) fcli_in_reply_to_status_id="$OPTARG";; f) fcli_file="$OPTARG";; h) fcli_help_flag="1";; + i) JS_Fields=("${JS_Fields[@]}" "$OPTARG");; ?) usage exit 2;; esac @@ -209,8 +212,19 @@ main () { ;; *) FO_command $fcli_command + JS_Parsed=$(echo "$FO_ret" | tokenize | parse) - echo "$JS_Parsed" + +# for a in ${JS_Parsed[@]}; do + +# if [ ${#JS_Fields[@]} != 0 ]; then +# for b in ${JS_Fields[@]}; do +# echo "$JS_Parsed" | js ${a} ${b} +# done +# else + echo "$JS_Parsed" +# fi +# done return $FO_rval ;; -- cgit v1.2.3