summaryrefslogtreecommitdiff
path: root/cmd/podman/system/connection/add.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-13 16:46:51 +0100
committerGitHub <noreply@github.com>2020-11-13 16:46:51 +0100
commit2993e97dec9d998d2eca7c5aee918b1429596a85 (patch)
tree9bdb3b5c766d913a8d1980ad017276e1f1a51b7c /cmd/podman/system/connection/add.go
parent6d9d9fee30b5982858d51a666f0c335ba47323a0 (diff)
parentae3816614de1c2a0c9ab9cd05afebc5b1dda6429 (diff)
downloadpodman-2993e97dec9d998d2eca7c5aee918b1429596a85.tar.gz
podman-2993e97dec9d998d2eca7c5aee918b1429596a85.tar.bz2
podman-2993e97dec9d998d2eca7c5aee918b1429596a85.zip
Merge pull request #6442 from Luap99/podman-autocomplete
Shell completion
Diffstat (limited to 'cmd/podman/system/connection/add.go')
-rw-r--r--cmd/podman/system/connection/add.go20
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd/podman/system/connection/add.go b/cmd/podman/system/connection/add.go
index 0d81a64ca..b3a23bffd 100644
--- a/cmd/podman/system/connection/add.go
+++ b/cmd/podman/system/connection/add.go
@@ -10,6 +10,7 @@ import (
"os/user"
"regexp"
+ "github.com/containers/common/pkg/completion"
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v2/cmd/podman/registry"
"github.com/containers/podman/v2/cmd/podman/system"
@@ -34,7 +35,8 @@ var (
"destination" is of the form [user@]hostname or
an URI of the form ssh://[user@]hostname[:port]
`,
- RunE: add,
+ RunE: add,
+ ValidArgsFunction: completion.AutocompleteNone,
Example: `podman system connection add laptop server.fubar.com
podman system connection add --identity ~/.ssh/dev_rsa testing ssh://root@server.fubar.com:2222
podman system connection add --identity ~/.ssh/dev_rsa --port 22 production root@server.fubar.com
@@ -57,9 +59,19 @@ func init() {
})
flags := addCmd.Flags()
- flags.IntVarP(&cOpts.Port, "port", "p", 22, "SSH port number for destination")
- flags.StringVar(&cOpts.Identity, "identity", "", "path to SSH identity file")
- flags.StringVar(&cOpts.UDSPath, "socket-path", "", "path to podman socket on remote host. (default '/run/podman/podman.sock' or '/run/user/{uid}/podman/podman.sock)")
+
+ portFlagName := "port"
+ flags.IntVarP(&cOpts.Port, portFlagName, "p", 22, "SSH port number for destination")
+ _ = addCmd.RegisterFlagCompletionFunc(portFlagName, completion.AutocompleteNone)
+
+ identityFlagName := "identity"
+ flags.StringVar(&cOpts.Identity, identityFlagName, "", "path to SSH identity file")
+ _ = addCmd.RegisterFlagCompletionFunc(identityFlagName, completion.AutocompleteDefault)
+
+ socketPathFlagName := "socket-path"
+ flags.StringVar(&cOpts.UDSPath, socketPathFlagName, "", "path to podman socket on remote host. (default '/run/podman/podman.sock' or '/run/user/{uid}/podman/podman.sock)")
+ _ = addCmd.RegisterFlagCompletionFunc(socketPathFlagName, completion.AutocompleteDefault)
+
flags.BoolVarP(&cOpts.Default, "default", "d", false, "Set connection to be default")
}