Stream: wg-cli

Topic: clap-vs-structopt

pksunkara (Jan 16 2020 at 21:22, on Zulip):

Hey @CreepySkeleton It's me.

Yerkebulan Tulibergenov (Jan 17 2020 at 05:09, on Zulip):

That’s a cool handle!

CreepySkeleton (Jan 17 2020 at 11:02, on Zulip):

Hi there! I'll be monitoring this thread for the next six hours, feel free to ask

pksunkara (Jan 17 2020 at 16:48, on Zulip):

So, I saw your message on one of the github issues that we want to combine the efforts for clap_derive and structopt. I completely agree with that. Let's consider it clap v3 release. Do you have any things you want to add to roadmap?

pksunkara (Jan 17 2020 at 16:48, on Zulip):

And also is there any document where we can tell people why clap_derive is better than structopt?

CreepySkeleton (Jan 17 2020 at 16:55, on Zulip):

yes, there are some thing I would like to change

no_version. It's like fifth leg for a dog, I really regret we've come up with this decision. I would love to replace it with "no version bu default" behavior along with explicit #[clap(version)] if user wants it to be derived from Cargo.toml

CreepySkeleton (Jan 17 2020 at 16:56, on Zulip):

Just like #[structopt(about/author)] work

CreepySkeleton (Jan 17 2020 at 16:58, on Zulip):

The second thing is - structopt uses one big trait for everything. It involves it's own drawbacks, like it is possible to flatten an enum (erroneously) , see

CreepySkeleton (Jan 17 2020 at 16:59, on Zulip):

This is how I would like it to work

CreepySkeleton (Jan 17 2020 at 17:03, on Zulip):

The third thing - structopt desperately needs refactoring. The current code is nothing more than a big batch of function calling each other is non-obvious ways, I would very much like it to build a parse tree, transform it to AST and then generate the result.

CreepySkeleton (Jan 17 2020 at 17:05, on Zulip):

It would also allow us to organize the code in passes, like "parsing", "transforming", "generic stuff", "generation". The passes are isolated from each other, each pass does well-defined set of things, producing the result. Right now, when you want to change something you have double check whether it can possibly interfere with some other part of code.

CreepySkeleton (Jan 17 2020 at 17:07, on Zulip):

It would also allow use to report error not just one-by-run, but a bunch of errors simultaneously

CreepySkeleton (Jan 17 2020 at 17:08, on Zulip):

I really hate this unfamiliar keyboard, lots of types :frown:

CreepySkeleton (Jan 17 2020 at 17:08, on Zulip):


CreepySkeleton (Jan 17 2020 at 17:09, on Zulip):

About the documenting part - well, we need two things here

CreepySkeleton (Jan 17 2020 at 17:09, on Zulip):

First - we need to proofread the existing documentation, it's organized quite poorly

CreepySkeleton (Jan 17 2020 at 17:10, on Zulip):

Also, I don't think that one big page is a good place for proc-macros documentation, see

CreepySkeleton (Jan 17 2020 at 17:13, on Zulip):

The second thing is obvious - "Moving from StructOpt to Clap_derive" guide, it has yet to be written. I would really love some help at this part since my English is far from perfect

CreepySkeleton (Jan 17 2020 at 17:14, on Zulip):

Well, that's about it. Everything else can be done after the release, I guesss

CreepySkeleton (Jan 17 2020 at 17:18, on Zulip):

End we will need to import the recent commits from structopt too :slight_smile:

CreepySkeleton (Jan 17 2020 at 17:24, on Zulip):

It looks like @kbknapp supports my "few separate traits" approach

CreepySkeleton (Jan 17 2020 at 17:25, on Zulip):

(I know, 2 years old, but still)

CreepySkeleton (Jan 17 2020 at 17:31, on Zulip):

Oh yes, I have some concerns about parse_* functions being inherent. This is quite a footgun loaded and ready to go off since users may want to add such a methods for themselves. It would clash with the generated ones. Maybe some sort of Parse trait?

CreepySkeleton (Jan 17 2020 at 17:32, on Zulip):

Also, we will need to settle down the organizational stuff with wg-cli? Who's gonna maintain the clap_derive repo (I would volunteer , maybe @TexIToi would too).

CreepySkeleton (Jan 17 2020 at 17:35, on Zulip):

Also, what do you think about ?

CreepySkeleton (Jan 17 2020 at 17:40, on Zulip):

OK, it's getting late, so I'm out. I'll try to be there tomorrow at 8AM UTC

pksunkara (Jan 17 2020 at 18:57, on Zulip):

I am readying a PR to get clap_derive merged into clap using cargo workspaces. So, we will have one big monorepo and all of us would maintain the single repo.

pksunkara (Jan 17 2020 at 18:58, on Zulip):

Regarding, IMO we should implement HashMap<K, V> support in Clap for arguments.

pksunkara (Jan 17 2020 at 19:02, on Zulip):

Regarding parse_*, can't we create something like #[clap(parse = "from_str") for all the inherent functions? That way, they won't clash with user generated ones. I think a Parse trait is too much here.

pksunkara (Jan 17 2020 at 19:08, on Zulip):

I am not seriously thrilled about the idea of separate traits. I made comments on the issue you linked.

pksunkara (Jan 17 2020 at 19:23, on Zulip):

Regarding passes, Absolutely. We can actually do it once we merge clap_derive into clap. I will help with that. Let's talk about this when we chat on call.

pksunkara (Jan 18 2020 at 10:21, on Zulip):

Also, look at this issue,

DPC (Jan 18 2020 at 11:00, on Zulip):

Just caught up with this conversation. Just waiting on a few things and will get clap 3.0 beta out after that. So try and if possible get your changes in before that :slight_smile: Thnaks

CreepySkeleton (Jan 18 2020 at 11:52, on Zulip):

Sure, just a little question - when is exactly "before that"? :slight_smile:

CreepySkeleton (Jan 18 2020 at 12:07, on Zulip):

The problem with #[structopt(parse)] is that there's already such magical method with different semantics. Could you please elaborate on why Parse trait is not good? AFAIK, it's just an extra use clap::Parse; from user perspective?

DPC (Jan 18 2020 at 17:15, on Zulip):

@CreepySkeleton i could give a timeframe, but then I already gave a timeframe 3-4 times and it is hard to meet timeframes in OSS world :P So preferably, let's strive for a beta by the end of this month :slight_smile: thanks

CreepySkeleton (Jan 18 2020 at 17:16, on Zulip):

@DPC Sounds good

Last update: Apr 16 2021 at 22:45UTC