@@ -11,9 +11,9 @@ mod build;
11
11
mod chroot;
12
12
mod profile;
13
13
mod recipe;
14
+ mod version;
14
15
15
16
#[ derive( Debug , Parser ) ]
16
- #[ command( version = serpent_buildinfo:: get_simple_version( ) ) ]
17
17
pub struct Command {
18
18
#[ command( flatten) ]
19
19
pub global : Global ,
@@ -23,6 +23,14 @@ pub struct Command {
23
23
24
24
#[ derive( Debug , Args ) ]
25
25
pub struct Global {
26
+ #[ arg(
27
+ short,
28
+ long = "verbose" ,
29
+ help = "Prints additional information about what boulder is doing" ,
30
+ default_value = "false" ,
31
+ global = true
32
+ ) ]
33
+ pub verbose : bool ,
26
34
#[ arg( long, global = true ) ]
27
35
pub cache_dir : Option < PathBuf > ,
28
36
#[ arg( long, global = true ) ]
@@ -39,19 +47,28 @@ pub enum Subcommand {
39
47
Chroot ( chroot:: Command ) ,
40
48
Profile ( profile:: Command ) ,
41
49
Recipe ( recipe:: Command ) ,
50
+ Version ( version:: Command ) ,
42
51
}
43
52
44
53
pub fn process ( ) -> Result < ( ) , Error > {
45
54
let args = replace_aliases ( std:: env:: args ( ) ) ;
46
55
let Command { global, subcommand } = Command :: parse_from ( args) ;
47
56
57
+ if global. verbose {
58
+ match subcommand {
59
+ Subcommand :: Version ( _) => ( ) ,
60
+ _ => version:: print ( ) ,
61
+ }
62
+ }
63
+
48
64
let env = Env :: new ( global. cache_dir , global. config_dir , global. data_dir , global. moss_root ) ?;
49
65
50
66
match subcommand {
51
67
Subcommand :: Build ( command) => build:: handle ( command, env) ?,
52
68
Subcommand :: Chroot ( command) => chroot:: handle ( command, env) ?,
53
69
Subcommand :: Profile ( command) => profile:: handle ( command, env) ?,
54
70
Subcommand :: Recipe ( command) => recipe:: handle ( command, env) ?,
71
+ Subcommand :: Version ( command) => version:: handle ( command) ,
55
72
}
56
73
57
74
Ok ( ( ) )
0 commit comments