Skip to content

Commit

Permalink
Listing keys one per line
Browse files Browse the repository at this point in the history
  • Loading branch information
katta committed Jan 14, 2014
1 parent bb39480 commit b3245ed
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions riakcli
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ checkForArgs() {
}

crl() {
curl -w "\n" $*
curl -sS -w "\n" $*
}

cput() {
Expand All @@ -72,7 +72,7 @@ listBuckets() {
listKeysInBucket() {
checkForArgs 1 "riakcli list keys [bucket-name]" $*
local BUCKET=$1
crl ${RIAK_BASE_URL}/buckets/${BUCKET}/keys?keys=true
crl ${RIAK_BASE_URL}/buckets/${BUCKET}/keys?keys=true
}

getObject() {
Expand Down Expand Up @@ -132,6 +132,10 @@ flush() {
done;
}

valuesFromJson() {
sed -e 's/^.*\[//g' -e 's/"//g' -e 's/\]\}//g' -e 's/,/\'$'\n/g'
}

### TOP LEVEL COMMANDS BEGIN ###


Expand All @@ -142,7 +146,7 @@ list() {
;;
"keys" )
shift
listKeysInBucket $*
listKeysInBucket $* | valuesFromJson
;;
* )
printInvalidUsage
Expand All @@ -166,7 +170,7 @@ search() {
case "$1" in
"by_index" )
shift
searchByIndex $*
searchByIndex $* | valuesFromJson
;;
* )
printInvalidUsage
Expand Down

0 comments on commit b3245ed

Please # to comment.