1 //! Dummy implementations that we emit along with an error.
2 
3 use proc_macro2::Ident;
4 use quote::quote;
5 
6 #[must_use]
parser(name: &Ident) -> proc_macro2::TokenStream7 pub fn parser(name: &Ident) -> proc_macro2::TokenStream {
8     let into_app = into_app(name);
9     quote!(
10         #[automatically_derived]
11         impl clap::Parser for #name {}
12         #into_app
13     )
14 }
15 
16 #[must_use]
into_app(name: &Ident) -> proc_macro2::TokenStream17 pub fn into_app(name: &Ident) -> proc_macro2::TokenStream {
18     quote! {
19         #[automatically_derived]
20         impl clap::CommandFactory for #name {
21             fn command<'b>() -> clap::Command {
22                 unimplemented!()
23             }
24             fn command_for_update<'b>() -> clap::Command {
25                 unimplemented!()
26             }
27         }
28     }
29 }
30 
31 #[must_use]
from_arg_matches(name: &Ident) -> proc_macro2::TokenStream32 pub fn from_arg_matches(name: &Ident) -> proc_macro2::TokenStream {
33     quote! {
34         #[automatically_derived]
35         impl clap::FromArgMatches for #name {
36             fn from_arg_matches(_m: &clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> {
37                 unimplemented!()
38             }
39             fn update_from_arg_matches(&mut self, matches: &clap::ArgMatches) -> ::std::result::Result<(), clap::Error>{
40                 unimplemented!()
41             }
42         }
43     }
44 }
45 
46 #[must_use]
subcommand(name: &Ident) -> proc_macro2::TokenStream47 pub fn subcommand(name: &Ident) -> proc_macro2::TokenStream {
48     let from_arg_matches = from_arg_matches(name);
49     quote! {
50         #[automatically_derived]
51         impl clap::Subcommand for #name {
52             fn augment_subcommands(_cmd: clap::Command) -> clap::Command {
53                 unimplemented!()
54             }
55             fn augment_subcommands_for_update(_cmd: clap::Command) -> clap::Command {
56                 unimplemented!()
57             }
58             fn has_subcommand(name: &str) -> bool {
59                 unimplemented!()
60             }
61         }
62         #from_arg_matches
63     }
64 }
65 
66 #[must_use]
args(name: &Ident) -> proc_macro2::TokenStream67 pub fn args(name: &Ident) -> proc_macro2::TokenStream {
68     let from_arg_matches = from_arg_matches(name);
69     quote! {
70         #[automatically_derived]
71         impl clap::Args for #name {
72             fn augment_args(_cmd: clap::Command) -> clap::Command {
73                 unimplemented!()
74             }
75             fn augment_args_for_update(_cmd: clap::Command) -> clap::Command {
76                 unimplemented!()
77             }
78         }
79         #from_arg_matches
80     }
81 }
82 
83 #[must_use]
value_enum(name: &Ident) -> proc_macro2::TokenStream84 pub fn value_enum(name: &Ident) -> proc_macro2::TokenStream {
85     quote! {
86         #[automatically_derived]
87         impl clap::ValueEnum for #name {
88             fn value_variants<'a>() -> &'a [Self]{
89                 unimplemented!()
90             }
91             fn from_str(_input: &str, _ignore_case: bool) -> ::std::result::Result<Self, String> {
92                 unimplemented!()
93             }
94             fn to_possible_value<'a>(&self) -> ::std::option::Option<clap::builder::PossibleValue>{
95                 unimplemented!()
96             }
97         }
98     }
99 }
100