File tree 3 files changed +40
-10
lines changed
3 files changed +40
-10
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ edition = "2021"
8
8
[dependencies ]
9
9
async-process = " 1.8.1"
10
10
bincode = " 1.3.3"
11
- clap = " 4.4.7"
11
+ clap = { version = " 4.4.7" , features = [ " derive " ] }
12
12
dag = { git = " https://github.com/serpent-os/moss-rs.git" , version = " 0.1.0" }
13
13
futures = " 0.3.29"
14
14
serde = { version = " 1.0.190" , features = [" derive" ] }
Original file line number Diff line number Diff line change 2
2
//
3
3
// SPDX-License-Identifier: MPL-2.0
4
4
5
- use clap:: Command ;
5
+ use clap:: { Parser , Subcommand } ;
6
6
use thiserror:: Error ;
7
7
8
- /// Generate the CLI command structure
9
- fn command ( ) -> Command {
10
- Command :: new ( "usysconf" )
11
- . about ( "Univeral system configuration" )
12
- . long_about ( "System configuration agent for modern Linux distributions to handle a variety of installation and removal triggers" )
13
- . arg_required_else_help ( true )
8
+ #[ derive( Parser ) ]
9
+ #[ command( author, version = None ) ]
10
+ #[ command( about = "Universal system configuration" ) ]
11
+ #[ command( long_about = "System configuration agent for modern linux distributions to handle a variety of installation and removal triggers" ) ]
12
+ #[ command( arg_required_else_help = true ) ]
13
+ struct Cli {
14
+ #[ command( subcommand) ]
15
+ command : Option < Commands > ,
14
16
}
15
17
18
+ #[ derive( Subcommand ) ]
19
+ enum Commands { }
20
+
16
21
/// Process CLI arguments for usysconf binary
17
22
pub fn process ( ) -> Result < ( ) , Error > {
18
- let _ = command ( ) . get_matches ( ) ;
19
- Err ( Error :: NotImplemented )
23
+ let cli = Cli :: parse ( ) ;
24
+
25
+ match & cli. command {
26
+ Some ( _) => return Err ( Error :: NotImplemented ) ,
27
+ None => { }
28
+ } ;
29
+
30
+ Ok ( ( ) )
20
31
}
21
32
22
33
#[ derive( Debug , Error ) ]
You can’t perform that action at this time.
0 commit comments