-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Splitting q into a library and executable? #16
Comments
If there are useful bits here they should probably move to https://github.com/miekg/dns/tree/master/dnsutil What bits are useful? |
Basically I'd like an API that's equivalent to the command-line API in |
[ Quoting <notifications@github.com> in "Re: [miekg/exdns] Splitting q into ..." ]
Basically I'd like an API that's equivalent to the command-line API in `q`, but as a Go function rather than a command-line tool, with function args instead of command-line flags, and with machine-readable return values instead of stdout/stderr output.
I don't think that should be added in this repo, as this is just examples.
For miekg/dns is also not applicable as it's too high level.
|
Okay. I guess I'll look into making a library fork of |
For anyone curious who's running across this issue, I've created a library fork of |
The
q
example is really nice, and I've wanted to use similar logic in a few of my projects (so that my own code can stick to a nice high-level API for DNS queries without re-implementing lots of DNS logic), but unfortunately since all of theq
code is in themain
package, it can't be used as a library. My initial workaround was just to copy and paste theq
code into my own projects and make changes as needed, but this doesn't exactly scale well.Would a PR be accepted that splits
q
into a library (which has all the code except for theflag
stuff and the stdout/stderr formatting, and renamesmain()
to a public function that accepts the args that are currently handled by globalflag
variables) and an executable (which has all theflag
and stdout/stderr formatting code and adds a simplemain()
function that calls the library using theflag
global variables as args)?(Alternatively, if a library that's similarly flexible and user-friendly as the
q
example is already exists, feel free to point me to that -- I looked around and couldn't find one.)The text was updated successfully, but these errors were encountered: