doggo icon indicating copy to clipboard operation
doggo copied to clipboard

Add -1/-single flag

Open cions opened this issue 1 year ago • 1 comments

This PR adds support for the -1, --single flag, which causes doggo to show the only single (randomly selected) address in the response. This is useful for scripting.

$ IPADDRESS="$(doggo -1 mrkaran.dev)"
$ echo $IPADDRESS
104.21.7.168

cions avatar Nov 09 '24 14:11 cions

Sorry for the delayed response. I'll be reviewing the PRs over the next week.

mr-karan avatar Mar 21 '25 07:03 mr-karan

Hey @cions, thanks for the PR and for taking the time to contribute!

I appreciate the use case you're trying to solve, but I'd prefer to keep doggo's feature set minimal and not add this flag. The same result can be achieved with existing functionality:

Using --short with head:

  IPADDRESS="$(doggo mrkaran.dev --short | head -1)"

Using --json with jq:

IPADDRESS="$(doggo mrkaran.dev --json | jq -r '.responses[0].answers[0].address')"

Both approaches work well for scripting scenarios and keep the tool's interface simpler. Adding a -1 flag would introduce complexity for marginal benefit when standard Unix tools can easily filter the output.

I hope you understand the reasoning behind keeping the scope focused. Thanks again for your contribution! 🙏

mr-karan avatar Oct 28 '25 13:10 mr-karan