Deno: Refactor CLI flag parsing

Created on 23 Mar 2019  Â·  6Comments  Â·  Source: denoland/deno

I have been putting this off long enough - and heard enough feedback from people that I’m ready to relent on some particular ideas I had around CLI parsing.

In particular, let’s move to the model the flags after the script are passed to Deno.args. Let’s allow for parameters to arguments so we can support evaluating oneliners (-e) and import maps. And we should consider making “deno —fmt” into “deno fmt”
Ideally there’s a rust crate which we can offload this onto? Anyone have proposals for such a crate? Anyone want to take this task on?

Most helpful comment

I can tackle it over the weekend

All 6 comments

What about Clap ? Seems to fit our need. It has some cool features like:

  • Auto-generated Help, Version, and Usage information
  • Auto-generated completion scripts at compile time (Bash, Zsh, Fish, and PowerShell)
  • Typed Values

And as far as the example shows, looks not really intrusive. Maybe check the weight of the Deno binary importing it?

@zekth seems very feature complete and would definitely work. I wonder if there are other more minimal options.

@piscisaureus thoughts?

@piscisaureus and I have reviewed clap and approve of it. Are there any volunteers for taking a first pass at using clap in //cli/flags.rs ?

I can tackle it over the weekend

@bartlomieju Cool - thanks - you're well positioned to tackle this. I'll get third_party setup for you today.

If backup needed, feel free to hit me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ry picture ry  Â·  3Comments

motss picture motss  Â·  3Comments

JosephAkayesi picture JosephAkayesi  Â·  3Comments

doutchnugget picture doutchnugget  Â·  3Comments

watilde picture watilde  Â·  3Comments