Ability to get all results without "Press key to continue..."
antonmos opened this issue · 5 comments
Ideally, detect when output is redirected to stdout and automatically pull all the pages.
OR
provide an option to automatically pull all the pages.
Loving this so far! Thank you!
use this script I made
#!/usr/bin/expect -f
set times 0;
while { $times < 300 } {
spawn ghs code Whateveryouwanttosearch
expect {
"Press key to continue..." { send "a"; exp_continue }
}}
set times [ expr $times+1]
done
@antonmos good idea!
So I see a couple options:
- detect if redirect is stdout, like you said. Do we check
isTTY
? https://nodejs.org/api/tty.html#tty_readstream_istty I've not ever done this - change the
--json
flag so it pages through all the results and you can pipe that tojq
or something. This would provide ultimate flexibility
With either one, you could potentially get rate limited and that might be hard to work around
Thoughts?
You should be able to handle the rate limit responses, wait and try again. It will take some time to get a full response but that still better than having to intervene manually, imho.
Istty does seem like the right way to do it.
https://stackoverflow.com/questions/39801643/detect-if-node-receives-stdin
My workaround:
yes | ghs code -o myorg foo-bar 2>/dev/null
Only tested with a couple of result pages. Not very clean though...