From 736983d7980d18e6fae9ab9498cc17e78f1ae5a5 Mon Sep 17 00:00:00 2001 From: Djordje Lukic Date: Thu, 17 Oct 2019 16:41:24 +0200 Subject: [PATCH] Pass the first arg directly Cobra makes sure that it's thee Signed-off-by: Djordje Lukic --- internal/commands/image/inspect.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/internal/commands/image/inspect.go b/internal/commands/image/inspect.go index e440d4529..8dd7c4453 100644 --- a/internal/commands/image/inspect.go +++ b/internal/commands/image/inspect.go @@ -18,13 +18,6 @@ type inspectOptions struct { pretty bool } -func firstOrEmpty(list []string) string { - if len(list) != 0 { - return list[0] - } - return "" -} - func muteDockerCli(dockerCli command.Cli) func() { stdout := dockerCli.Out() stderr := dockerCli.Err() @@ -43,7 +36,7 @@ func inspectCmd(dockerCli command.Cli) *cobra.Command { $docker app inspect my-app:1.0.0`, Args: cli.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { - return runInspect(dockerCli, firstOrEmpty(args), opts) + return runInspect(dockerCli, args[0], opts) }, } cmd.Flags().BoolVar(&opts.pretty, "pretty", false, "Pretty print the output")