mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
proc: working command, expose
This commit is contained in:
parent
751e01a41e
commit
046be9a9e1
2 changed files with 24 additions and 13 deletions
|
|
@ -62,6 +62,7 @@ impl ToTokens for CommandDef {
|
|||
let implementations = exposed.values().map(CommandArm::to_implementation);
|
||||
write_quote_to(out, quote! {
|
||||
/// Generated by [tengri_proc].
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum #enumeration {
|
||||
#(#variants)*
|
||||
}
|
||||
|
|
@ -123,9 +124,11 @@ impl CommandArm {
|
|||
if with_values {
|
||||
let take_err = LitStr::new(&format!("{}: missing argument \"{}\" ({})",
|
||||
quote!{#ident}, quote!{#pat}, quote!{#ty}), Span::call_site());
|
||||
let give_err = LitStr::new(&format!("{}: missing value \"{}\" ({})",
|
||||
quote!{#ident}, quote!{#pat}, quote!{#ty}), Span::call_site());
|
||||
write_quote_to(&mut out, quote! {
|
||||
: Context::get(state, &iter.next().expect(#take_err).value)
|
||||
});
|
||||
.expect(#give_err) });
|
||||
}
|
||||
} else {
|
||||
unreachable!("only typed args should be present at this position")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue