You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
Hello!
After talking about thunder with @spacekookie, she told me about a effort to rewrite thunder to have a better usability and code.
Thinking about that, I thought about proposing a new way to write thunder apps.
So far my proposal would make a simple hello world look like this:
#![feature(use_extern_macros)]externcrate thunder_derive;externcrate thunder;#[derive(ThunderApp)]structThor{/// Bla bla bl#[thunder(take_value = false)]// Default is to take valuedrunk:bool,/// What will be Thor's age today#[thunder(default_value = 1342)]// Can configure flag default valueage:i32}#[thunderclap]implThor{/// This is a subcommand, as beforefnhello(&self,name:Option<&str>){println!("Hello, {}! Nice to meet you, I'm Thor and I'm {} years old", name.unwrap_or("world"),self.age);}fnme(&self){let drunk = ifself.drunk{"drunk!"}else{"not drunk!"};println!("Huh, me? I'm Thor! And I'm {}");}}fnmain(){Thor::start();}
This is strongly inspired by structopt.
The main idea is to have global args parsing work like normal args do in structopt, and subcommands work as they work right now. Thus being more flexible, while still being fast to iterate.
I couldn't think about how to make subcommand arguments as flexible, but it's on my list of things to improve too
The text was updated successfully, but these errors were encountered:
Actually, looking at that, the question is if we don't just want to integrate the custom derive part with clapitself (structopt is part of clap as of verion 3.0.0).
At that point the thunder part of the crate would remain the attribute on the impl block.
#[derive(cli)]structMyApp{// ... do things the same as clap.rs 3.0.0}#[thunderclap]implMyApp{// ... only generate matching code via thunderclap}
Does this duplicate some workflow? I wouldn't think so, right? Because even with structopt/clapv3 you still need to write all the matching code yourself?
I didn't know about the clap 3.0 and structopt merge! I'll go there and see how it works.
I also think it wouldn't duplicate work as well. I got a new idea on how to make subcommand args more flexible and will also take a look if it can be achieved with clap 3.0 before updating here
I was about to create a new issue about using this on stable now that proc_macros are stable when I ran across this.
So now I'm thinking that whether it should be its own issue depends on the time frame for this issue.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello!
After talking about thunder with @spacekookie, she told me about a effort to rewrite thunder to have a better usability and code.
Thinking about that, I thought about proposing a new way to write thunder apps.
So far my proposal would make a simple hello world look like this:
This is strongly inspired by structopt.
The main idea is to have global args parsing work like normal args do in structopt, and subcommands work as they work right now. Thus being more flexible, while still being fast to iterate.
I couldn't think about how to make subcommand arguments as flexible, but it's on my list of things to improve too
The text was updated successfully, but these errors were encountered: