whiteinge/ok.sh

No usable output from script

AdamBrousseau opened this issue · 5 comments

Likely a user problem and not an issue. I am not able to get any useful output from the tool.

Following the one example in the wiki
ok.sh list_repos octocat _filter='.[] | select(.fork == false) | .clone_url'
returns nothing (with or without the filter).
adding -v

+ curl -nsSi -H Accept: application/vnd.github.v3+json -H Content-Type: application/json -X GET https://api.github.com/users/octocat/repos?AWKLIBPATH=%2Fusr%2Flib%2Fx86%5F64%2Dlinux%2Dgnu%2Fgawk
+ set +x
ok.sh INFO: Follow_next: 1
ok.sh INFO: Remaining next link follows: 50

once I add -vvv I get lots of json output but this is hardly usable.
I'm not sure if I am doing something wrong or if I misunderstood what the expected output should be. Any help would be appreciated.

@AdamBrousseau Hi, sorry for the slow reply.

My initial guess is the output is getting lost as it's going through jq. What version of jq do you have installed? IIRC, 1.3 is the minimum required version. I tried your command with 1.3 and 1.5 and see the expected output:

% ok.sh list_repos octocat _filter='.[] | select(.fork == false) | .clone_url'
https://github.com/octocat/git-consortium.git
https://github.com/octocat/hello-worId.git
https://github.com/octocat/Hello-World.git
https://github.com/octocat/octocat.github.io.git
https://github.com/octocat/Spoon-Knife.git
https://github.com/octocat/test-repo1.git

You can bypass the jq processing via ok.sh -j list_repos octocat which should at least give you output. Though, like you said, lots of JSON output is hardly usable. 😄

Was a user issue. Recloned and worked fine. Thanks for your response.