-
Notifications
You must be signed in to change notification settings - Fork 427
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
First cut cmdliner support #5
Conversation
Default subcommand is now help (as normal). And building targets has been moved to the build subcommand.
src/cmdliner.mllib
Outdated
@@ -0,0 +1,11 @@ | |||
Cmdliner_suggest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need this file
src/main.ml
Outdated
let common = | ||
let make concurrency debug_rules debug_dep_path debug_findlib = | ||
{ concurrency ; debug_rules ; debug_dep_path ; debug_findlib } in | ||
let concurrency = Arg.(value & opt int 1 & info ["-j"]) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the current default is 4 for -j
Thanks, that looks good. However, when I run Regarding the default subcommand, I see your point but I think that's what most build systems do though and I would expect I have two other questions, as I don't know cmdliner well:
Regarding the result hack, I'm fine with just adding the |
On 02/16, Jérémie Dimino wrote:
Thanks, that looks good. However, when I run `jbuilder build --help`, I can see that options are named `---j`, `---drules` instead of `-j` or `--drules`.
I fixed this. But the long rule names are changed to long option style --drules.
This is the convention that cmdliner enforces, and it's pretty standard so I
think it's a positive change.
Regarding the default subcommand, I see your point but I think that's what most build systems do though and I would expect `jbuilder <target>` to just work. I think it's good to have an explicit `build` subcommand but it should still be the default.
OK I changed the default subcommand. I still think that it's not so good
usability wise. We could easily have a subcommand and a target named the same
way. And most other builds don't support subcommands anyway, so the comparison
is a bit artificial.
I have two other questions, as I don't know cmdliner well:
- I see that the `internal` function still does a manual pattern matching, is it possible to define subsubcommands with cmdliner?
It's possible but I also don't know how to do it. I'm sure it can be done as
opam clearly does it, but I do think that it requires writing more code than
you'd expect. I'll look at this more in depth but I think this can be postponed
tbh.
- Do you know if the common options could be grouped under a section `COMMON OPTIONS` in the man pages?
I tried fixing this, what do you think?
Regarding the result hack, I'm fine with just adding the `Result` module, the less modifications we do the vendored code, the easier it will be to upgrade it
OK. But how do I do this though? It doesn't seem like bootstrapping is using
findlib which is the only way I know of adding result. Also, it's a bit of a
shame we have to add the dependency on findlib.
|
Agreed
That's true. But you can always do
Ok. I agree that's this can be postponed
Thanks, the doc looks better now
We can just add a |
I moved cmdliner sources to BTW I found this issue about supporting nested commands: dbuenzli/cmdliner#24 |
In the end setting |
Attempted to complete one of the TODO items listed in the repository.
The only intended change to the command line itself is just add an explicit
subcommand for building targets. I'd recommend to keep that because default
subcommands are unnatural and somewhat rare.
Feel free to change/modify anything according to your taste otherwise.
TODO: