@@ -39,15 +39,17 @@ pub struct Flags {
39
39
/// Shim action (start / delete).
40
40
/// See <https://github.com/containerd/containerd/blob/master/runtime/v2/shim/shim.go#L191>
41
41
pub action : String ,
42
+ /// Version of the shim.
43
+ pub version : bool ,
42
44
}
43
45
44
46
/// Parses command line arguments passed to the shim.
45
- /// This func replicates https://github.com/containerd/containerd/blob/master/runtime/v2/shim/shim.go#L110
46
47
pub fn parse < S : AsRef < OsStr > > ( args : & [ S ] ) -> Result < Flags > {
47
48
let mut flags = Flags :: default ( ) ;
48
49
49
50
let args: Vec < String > = go_flag:: parse_args ( args, |f| {
50
51
f. add_flag ( "debug" , & mut flags. debug ) ;
52
+ f. add_flag ( "v" , & mut flags. version ) ;
51
53
f. add_flag ( "namespace" , & mut flags. namespace ) ;
52
54
f. add_flag ( "id" , & mut flags. id ) ;
53
55
f. add_flag ( "socket" , & mut flags. socket ) ;
@@ -61,12 +63,6 @@ pub fn parse<S: AsRef<OsStr>>(args: &[S]) -> Result<Flags> {
61
63
flags. action = action. into ( ) ;
62
64
}
63
65
64
- if flags. namespace . is_empty ( ) {
65
- return Err ( Error :: InvalidArgument ( String :: from (
66
- "Shim namespace cannot be empty" ,
67
- ) ) ) ;
68
- }
69
-
70
66
Ok ( flags)
71
67
}
72
68
@@ -125,11 +121,4 @@ mod tests {
125
121
assert_eq ! ( flags. action, "start" ) ;
126
122
assert_eq ! ( flags. id, "" ) ;
127
123
}
128
-
129
- #[ test]
130
- fn no_namespace ( ) {
131
- let empty: [ String ; 0 ] = [ ] ;
132
- let result = parse ( & empty) . err ( ) ;
133
- assert ! ( result. is_some( ) )
134
- }
135
124
}
0 commit comments