@@ -54,6 +54,8 @@ pub enum CscsCommands {
5454 command : CscsSystemCommands ,
5555 } ,
5656}
57+
58+ #[ allow( clippy:: large_enum_variant) ]
5759#[ derive( Subcommand , Debug ) ]
5860pub enum CscsJobCommands {
5961 #[ clap( alias( "ls" ) , about = "List all jobs [aliases: ls]" ) ]
@@ -75,6 +77,8 @@ pub enum CscsJobCommands {
7577 workdir : Option < String > ,
7678 #[ clap( short='E' , value_name="KEY=VALUE" , value_parser=parse_key_val:: <String , String >, help="Environment variables to set in the container" ) ]
7779 env : Vec < ( String , String ) > ,
80+ #[ clap( short='M' , value_name="PATH:CONTAINER_PATH" , value_parser=parse_key_val_colon:: <String , String >, help="Paths to mount inside container" ) ]
81+ mount : Vec < ( String , String ) > ,
7882 #[ clap( short, long, help = "The docker image to use" ) ]
7983 image : Option < DockerImageUrl > ,
8084 #[ clap( trailing_var_arg = true , help = "The command to run in the container" ) ]
@@ -178,3 +182,15 @@ where
178182 . ok_or_else ( || format ! ( "invalid KEY=value: no `=` found in `{s}`" ) ) ?;
179183 Ok ( ( s[ ..pos] . parse ( ) ?, s[ pos + 1 ..] . parse ( ) ?) )
180184}
185+ fn parse_key_val_colon < T , U > ( s : & str ) -> Result < ( T , U ) , Box < dyn Error + Send + Sync + ' static > >
186+ where
187+ T : std:: str:: FromStr ,
188+ T :: Err : Error + Send + Sync + ' static ,
189+ U : std:: str:: FromStr ,
190+ U :: Err : Error + Send + Sync + ' static ,
191+ {
192+ let pos = s
193+ . find ( ':' )
194+ . ok_or_else ( || format ! ( "invalid KEY:value: no `:` found in `{s}`" ) ) ?;
195+ Ok ( ( s[ ..pos] . parse ( ) ?, s[ pos + 1 ..] . parse ( ) ?) )
196+ }
0 commit comments