@@ -41,7 +41,12 @@ pub const SPIN_WORKING_DIR: &str = "SPIN_WORKING_DIR";
4141 usage = "spin [COMMAND] [OPTIONS]" ,
4242 next_help_heading = help_heading:: <T , B :: Factors >( )
4343) ]
44- pub struct FactorsTriggerCommand < T : Trigger < B :: Factors > , B : RuntimeFactorsBuilder > {
44+ pub struct FactorsTriggerCommand < T , B >
45+ where
46+ T : Trigger < B :: Factors > ,
47+ T :: GlobalConfig : Args ,
48+ B : RuntimeFactorsBuilder ,
49+ {
4550 /// Log directory for the stdout and stderr of components. Setting to
4651 /// the empty string disables logging to disk.
4752 #[ clap(
@@ -110,7 +115,7 @@ pub struct FactorsTriggerCommand<T: Trigger<B::Factors>, B: RuntimeFactorsBuilde
110115 pub state_dir : Option < String > ,
111116
112117 #[ clap( flatten) ]
113- pub trigger_args : T :: CliArgs ,
118+ pub trigger_args : T :: GlobalConfig ,
114119
115120 #[ clap( flatten) ]
116121 pub builder_args : B :: CliArgs ,
@@ -139,12 +144,17 @@ pub struct FactorsConfig {
139144 pub log_dir : UserProvidedPath ,
140145}
141146
142- /// An empty implementation of clap::Args to be used as TriggerExecutor::RunConfig
143- /// for executors that do not need additional CLI args.
147+ /// This type may be used as the [`Trigger::GlobalConfig`] for triggers with no
148+ /// CLI args.
144149#[ derive( Args ) ]
145- pub struct NoCliArgs ;
146-
147- impl < T : Trigger < B :: Factors > , B : RuntimeFactorsBuilder > FactorsTriggerCommand < T , B > {
150+ pub struct NoGlobalConfig ;
151+
152+ impl < T , B > FactorsTriggerCommand < T , B >
153+ where
154+ T : Trigger < B :: Factors > ,
155+ T :: GlobalConfig : Args ,
156+ B : RuntimeFactorsBuilder ,
157+ {
148158 /// Create a new TriggerExecutorBuilder from this TriggerExecutorCommand.
149159 pub async fn run ( self ) -> Result < ( ) > {
150160 // Handle --help-args-only
@@ -383,10 +393,10 @@ pub mod help {
383393
384394 impl < F : RuntimeFactors > Trigger < F > for HelpArgsOnlyTrigger {
385395 const TYPE : & ' static str = "help-args-only" ;
386- type CliArgs = NoCliArgs ;
396+ type GlobalConfig = NoGlobalConfig ;
387397 type InstanceState = ( ) ;
388398
389- fn new ( _cli_args : Self :: CliArgs , _app : & App ) -> anyhow:: Result < Self > {
399+ fn new ( _cfg : Self :: GlobalConfig , _app : & App ) -> anyhow:: Result < Self > {
390400 Ok ( Self )
391401 }
392402
0 commit comments