This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Is https://github.com/clojure/tools.cli/blob/master/README.md the best/only docs for parse-opts
?
I'm using it for the first time.
One thing I'd like to know is if I can define an opt --foo
such that --foo
will have value true
and --foo=bar
will have value "bar"
.
I've only skimmed that page above as a README seems like it shouldn't be the real doc...
Also http://clojure.github.io/tools.cli/ for api docs
I saw that one but > THIS IS A LEGACY FUNCTION and may be deprecated in the future. Please use clojure.tools.cli/parse-opts in new applications.
I guess I'm mostly looking for a detailed description of each keyword available for the cli-options
data.
(doc clojure.tools.cli/parse-opts)
is it!@U064X3EF3 is there an html version of (doc clojure.tools.cli/parse-opts)
(besides the github source code)?
On that very page linked above: https://clojure.github.io/tools.cli/#clojure.tools.cli/parse-opts
The "legacy function" warning is not for the whole page but for the cli
function that happens to be documented the first.
ooooh
I didn't get that 😕
The API docs' reference to https://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html suggests it does not have the --foo, --foo=bar ability
Thanks for following up, @U0HG4EHMH
I couldn't figure out how to do it.
Here's what I ended up with so far:
https://github.com/yaml/yamlscript/blob/cli/cli/src/yamlscript/cli.clj#L14-L37
I was trying to do that with --compile
but ended up using --compile-to=...
Not sure what they mean by > To specify an argument for a long option, write --name=value. This syntax enables a long option to accept an argument that is itself optional. in that link you posted...
Maybe --name=
?
As maintainer of tools.cli
, I'd be happy to hear specific, actionable feedback on the docs. Feel free to put suggestions/questions on http://ask.clojure.org -- it's a not a library I've needed to spend much time on since I took it over (originally, I took it on because we used it in several tools at work but those have all been simplified now so we've stopped using tools.cli
).
It's a pretty good getopt library. I've used a bunch of different ones and even written a couple. The one thing that would have helped me today is if the GitHub repo pointed to the documentation web page. I can probably make a PR for that tomorrow.
It's a Contrib project so it doesn't accept PRs. As a Contrib project, it's generated API docs are available at https://clojure.github.io/tools.cli/ and the README does link to that (all the Contrib projects get API docs like that). http://cljdoc.org allows anyone to request API docs for any published library which is why https://cljdoc.org/d/org.clojure/tools.cli/ also exists).
README:
> Please see the https://github.com/clojure/tools.cli#example-usage for a more detailed example and refer to the docstring of parse-opts
for comprehensive documentation:
>
> http://clojure.github.io/tools.cli/index.html#clojure.tools.cli/parse-opts
I just added: > (as part of the http://clojure.github.io/tools.cli/) to that para which hopefully makes it a bit more obvious?