udoprog/genco

Support generating documentation and comments

adamcavendish opened this issue · 2 comments

I wonder whether there's support to help generate documentation.

quote! {
    #[derive(argh::FromArgs, PartialEq, Debug)]
    #[argh(subcommand)]
    pub enum Subcommand {
        // the command set A
        $(for v in command_a.iter() => a_$v(CommandA_$v),$['\r'])
        // the command set B
        $(for v in command_b.iter() => b_$v(CommandB_$v),$['\r'])
    }
}

In the generated code, the comments are removed i.e. // the command set A and // the command set B.
I know it's expected since rust will eliminate comments on compilation. However, I do wonder whether we can support generating the comments into the generated code so we can have better documents in the generated code.

I'd recommend using a helper like this. It's used like this.

Yeah, this is pretty awesome. Thanks! Better to have it supported in the genco itself.