Skip to content

Commit

Permalink
refactor: removing jq dep
Browse files Browse the repository at this point in the history
  • Loading branch information
justchokingaround authored Jul 15, 2022
1 parent b473a2d commit 0c1ecca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kona-cli
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/bin/ksh
#!/bin/sh

get_new(){

last_id=$(cat ~/.cache/konachan)
latest_id=$(curl -s 'https://konachan.com/post.json' | jq '.[0].id')
latest_id=$(curl -s 'https://konachan.com/post.json'|sed -En 's_\[\{"id":([0-9]*),.*_\1_p')

if [ "$latest_id" -ne "$last_id" ]
then

json_data=$(curl -s 'https://konachan.com/post.json' | jq '.[]' | sed -n "/\"id\": $(printf '%s' "$last_id")/q;p" | sed '$d')
curl -s 'https://konachan.com/post.json' | jq '.[0].id' > ~/.cache/konachan &
printf "%s" "$latest_id" > ~/.cache/konachan &

main "$json_data"

Expand Down Expand Up @@ -40,7 +40,7 @@ search(){
if [ -n "$1" ] && [ -n "$2" ]
then

tag_list=$(curl -s "https://konachan.com/tag.json?limit=10" -d "order=count" -d "name=$2" | jq '.[].name' | tr -d '"')
tag_list=$(curl -s "https://konachan.com/tag.json?limit=10" -d "order=count" -d "name=$2"|tr '"' '\n'|sed -n '/name/{n;n;p;}')

PS3=$(printf '\n\x1B[34m%s\x1B[0m\n' "Choose your mood: ")
export PS3
Expand Down

0 comments on commit 0c1ecca

Please sign in to comment.