MichalGniadek / klask

Automatically create GUI applications from clap3 apps
MIT License
376 stars 23 forks source link

"Internal Error" on minimal clap app #54

Closed barafael closed 1 year ago

barafael commented 1 year ago

I just discovered there is a minimal case where klask crashes with a not-so-helpful error message:

use clap::Parser;
use klask::Settings;
use std::{thread, time::Duration};

#[derive(Debug, Parser)]
struct Args {
    verbose: bool,
}

fn main() {
    klask::run_derived::<Args, _>(Settings::default(), |args| {
        dbg!(args);
    });
}

It's arg_state.rs:280, trying to get the name of the bool, which isn't available as it is not annotated with #[clap(short, long)]. I suppose this makes sense, and there isn't a good way to handle this, right? Perhaps I might add some more helpful error messages, if you like.