@@ -18,6 +18,7 @@ package run
1818
1919import (
2020 "context"
21+ "errors"
2122 "fmt"
2223 "io"
2324 "os"
@@ -43,7 +44,7 @@ func Command(contextType string) *cobra.Command {
4344 if len (args ) > 1 {
4445 opts .Command = args [1 :]
4546 }
46- return runRun (cmd .Context (), args [0 ], opts )
47+ return runRun (cmd .Context (), args [0 ], contextType , opts )
4748 },
4849 }
4950 cmd .Flags ().SetInterspersed (false )
@@ -58,15 +59,22 @@ func Command(contextType string) *cobra.Command {
5859 cmd .Flags ().StringArrayVarP (& opts .Environment , "env" , "e" , []string {}, "Set environment variables" )
5960 cmd .Flags ().StringArrayVar (& opts .EnvironmentFiles , "env-file" , []string {}, "Path to environment files to be translated as environment variables" )
6061 cmd .Flags ().StringVarP (& opts .RestartPolicyCondition , "restart" , "" , containers .RestartPolicyNone , "Restart policy to apply when a container exits" )
62+ cmd .Flags ().BoolVar (& opts .Rm , "rm" , false , "Automatically remove the container when it exits" )
6163
6264 if contextType == store .AciContextType {
6365 cmd .Flags ().StringVar (& opts .DomainName , "domainname" , "" , "Container NIS domain name" )
6466 }
6567
68+ _ = cmd .Flags ().MarkHidden ("rm" )
69+
6670 return cmd
6771}
6872
69- func runRun (ctx context.Context , image string , opts run.Opts ) error {
73+ func runRun (ctx context.Context , image string , contextType string , opts run.Opts ) error {
74+ if opts .Rm {
75+ return errors .New (`Option "rm" is not yet implemented for context type: ` + contextType )
76+ }
77+
7078 c , err := client .New (ctx )
7179 if err != nil {
7280 return err
0 commit comments