@@ -30,12 +30,15 @@ func main() {
3030 rootCmd .AddCommand (cmdList )
3131
3232 cmdExec := & cobra.Command {
33- Use : "exec DEVCONTAINER_NAME COMMAND" ,
33+ Use : "exec DEVCONTAINER_NAME COMMAND [args...] " ,
3434 Short : "Execute a command in a devcontainer" ,
3535 Long : "Execute a command in a devcontainer, similar to `docker exec`." ,
3636 Run : func (cmd * cobra.Command , args []string ) {
3737 runExecCommand (cmd , args )
3838 },
39+ Args : cobra .ArbitraryArgs ,
40+ DisableFlagParsing : true ,
41+ DisableFlagsInUseLine : true ,
3942 ValidArgsFunction : func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
4043 // only completing the first arg (devcontainer name)
4144 if len (args ) != 0 {
@@ -120,7 +123,10 @@ func runListCommand(cmd *cobra.Command, args []string, listIncludeContainerNames
120123func runExecCommand (cmd * cobra.Command , args []string ) {
121124 // TODO argument validation!
122125
123- fmt .Printf ("TODO - exec: %v\n " , args )
126+ if len (args ) < 2 {
127+ cmd .Usage ()
128+ os .Exit (1 )
129+ }
124130
125131 devcontainerName := args [0 ]
126132 devcontainers , err := devcontainers .ListDevcontainers ()
0 commit comments