aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/registry
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/registry')
-rw-r--r--cmd/podman/registry/remote.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/podman/registry/remote.go b/cmd/podman/registry/remote.go
index 78b820269..6e9b1fdfc 100644
--- a/cmd/podman/registry/remote.go
+++ b/cmd/podman/registry/remote.go
@@ -5,6 +5,7 @@ import (
"sync"
"github.com/containers/podman/v2/pkg/domain/entities"
+ "github.com/spf13/cobra"
"github.com/spf13/pflag"
)
@@ -23,7 +24,15 @@ func IsRemote() bool {
fs.Usage = func() {}
fs.SetInterspersed(false)
fs.BoolVarP(&remoteFromCLI.Value, "remote", "r", false, "")
- _ = fs.Parse(os.Args[1:])
+
+ // The shell completion logic will call a command called "__complete" or "__completeNoDesc"
+ // This command will always be the second argument
+ // To still parse --remote correctly in this case we have to set args offset to two in this case
+ start := 1
+ if len(os.Args) > 1 && (os.Args[1] == cobra.ShellCompRequestCmd || os.Args[1] == cobra.ShellCompNoDescRequestCmd) {
+ start = 2
+ }
+ _ = fs.Parse(os.Args[start:])
})
return podmanOptions.EngineMode == entities.TunnelMode || remoteFromCLI.Value
}