40
40
//! }
41
41
//!
42
42
//! #[derive(clap::Parser)]
43
- //! #[clap (
43
+ //! #[command (
44
44
//! name = "Foobar Operator",
45
45
//! author,
46
46
//! version,
52
52
//! }
53
53
//!
54
54
//! # fn main() -> OperatorResult<()> {
55
- //! let opts = Opts::from_args ();
55
+ //! let opts = Opts::parse ();
56
56
//!
57
57
//! match opts.command {
58
58
//! cli::Command::Crd => {
75
75
//! use stackable_operator::error::OperatorResult;
76
76
//!
77
77
//! #[derive(clap::Parser)]
78
- //! #[clap (
78
+ //! #[command (
79
79
//! name = "Foobar Operator",
80
80
//! author,
81
81
//! version,
87
87
//! }
88
88
//!
89
89
//! # fn main() -> OperatorResult<()> {
90
- //! let opts = Opts::from_args ();
90
+ //! let opts = Opts::parse ();
91
91
//!
92
92
//! match opts.command {
93
93
//! cli::Command::Crd => {
@@ -133,7 +133,7 @@ pub const AUTHOR: &str = "Stackable GmbH - info@stackable.de";
133
133
#[ derive( clap:: Parser , Debug , PartialEq , Eq ) ]
134
134
// The enum-level doccomment is intended for developers, not end users
135
135
// so supress it from being included in --help
136
- #[ clap ( long_about = "" ) ]
136
+ #[ command ( long_about = "" ) ]
137
137
pub enum Command < Run : Args = ProductOperatorRun > {
138
138
/// Print CRD objects
139
139
Crd ,
@@ -174,7 +174,7 @@ pub enum Command<Run: Args = ProductOperatorRun> {
174
174
/// # use stackable_operator::cli::{Command, ProductOperatorRun};
175
175
/// #[derive(clap::Parser, Debug, PartialEq, Eq)]
176
176
/// struct Run {
177
- /// #[clap (long)]
177
+ /// #[arg (long)]
178
178
/// name: String,
179
179
/// }
180
180
/// use clap::Parser;
@@ -184,28 +184,27 @@ pub enum Command<Run: Args = ProductOperatorRun> {
184
184
/// }));
185
185
/// ```
186
186
#[ derive( clap:: Parser , Debug , PartialEq , Eq ) ]
187
- #[ clap ( long_about = "" ) ]
187
+ #[ command ( long_about = "" ) ]
188
188
pub struct ProductOperatorRun {
189
189
/// Provides the path to a product-config file
190
- #[ clap (
190
+ #[ arg (
191
191
long,
192
192
short = 'p' ,
193
193
value_name = "FILE" ,
194
194
default_value = "" ,
195
- env,
196
- parse( from_os_str)
195
+ env
197
196
) ]
198
197
pub product_config : ProductConfigPath ,
199
198
/// Provides a specific namespace to watch (instead of watching all namespaces)
200
- #[ clap ( long, env, default_value = "" , parse ( from_str ) ) ]
199
+ #[ arg ( long, env, default_value = "" ) ]
201
200
pub watch_namespace : WatchNamespace ,
202
201
/// Tracing log collector system
203
- #[ clap ( long, env, default_value_t, arg_enum ) ]
202
+ #[ arg ( long, env, default_value_t, value_enum ) ]
204
203
pub tracing_target : TracingTarget ,
205
204
}
206
205
207
206
/// A path to a [`ProductConfigManager`] spec file
208
- #[ derive( Debug , PartialEq , Eq ) ]
207
+ #[ derive( Clone , Debug , PartialEq , Eq ) ]
209
208
pub struct ProductConfigPath {
210
209
path : Option < PathBuf > ,
211
210
}
@@ -274,6 +273,12 @@ mod tests {
274
273
const DEFAULT_FILE_PATH : & str = "default_file_path_properties.yaml" ;
275
274
const WATCH_NAMESPACE : & str = "WATCH_NAMESPACE" ;
276
275
276
+ #[ test]
277
+ fn verify_cli ( ) {
278
+ use clap:: CommandFactory ;
279
+ ProductOperatorRun :: command ( ) . debug_assert ( )
280
+ }
281
+
277
282
#[ rstest]
278
283
#[ case(
279
284
Some ( USER_PROVIDED_PATH ) ,
0 commit comments