@@ -45,22 +45,21 @@ pub struct Config<S>
45
45
where
46
46
S : Clone + clap:: Args + StorageOpt ,
47
47
{
48
- pub parseable : Opt < S > ,
48
+ pub parseable : Server < S > ,
49
49
}
50
50
51
51
impl < S > Config < S >
52
52
where
53
53
S : Clone + clap:: Args + StorageOpt ,
54
54
{
55
55
fn new ( ) -> Self {
56
- let parseable = match Opt :: < S > :: try_parse ( ) {
56
+ let Cli :: Server :: < S > ( args ) = match Cli :: < S > :: try_parse ( ) {
57
57
Ok ( s) => s,
58
58
Err ( e) => {
59
- eprintln ! ( "You can also use the --demo flag to run Parseable with default object storage. For testing purposes only" ) ;
60
59
e. exit ( ) ;
61
60
}
62
61
} ;
63
- Config { parseable }
62
+ Config { parseable : args }
64
63
}
65
64
66
65
pub fn storage ( & self ) -> & S {
@@ -148,13 +147,23 @@ where
148
147
}
149
148
}
150
149
151
- #[ derive( Debug , Clone , Parser ) ]
150
+ #[ derive( Parser ) ] // requires `derive` feature
152
151
#[ command(
153
152
name = "Parseable" ,
154
- about = "Configuration for Parseable server" ,
153
+ bin_name = "parseable" ,
154
+ about = "Parseable is a log storage and observability platform." ,
155
155
version
156
156
) ]
157
- pub struct Opt < S >
157
+ enum Cli < S >
158
+ where
159
+ S : Clone + clap:: Args + StorageOpt ,
160
+ {
161
+ Server ( Server < S > ) ,
162
+ }
163
+
164
+ #[ derive( clap:: Args , Debug , Clone ) ]
165
+ #[ clap( name = "server" , about = "Start the Parseable server" ) ]
166
+ pub struct Server < S >
158
167
where
159
168
S : Clone + clap:: Args + StorageOpt ,
160
169
{
@@ -222,7 +231,7 @@ where
222
231
pub demo : bool ,
223
232
}
224
233
225
- impl < S > Opt < S >
234
+ impl < S > Server < S >
226
235
where
227
236
S : Clone + clap:: Args + StorageOpt ,
228
237
{
0 commit comments