1
0
mirror of https://github.com/rancher/os.git synced 2025-09-03 07:44:21 +00:00

Add docker Bash completion for other consoles

This commit is contained in:
hailong
2019-01-02 02:56:27 +00:00
committed by niusmallnan
parent 8cdf21d03a
commit 4d834140d0
3 changed files with 26 additions and 5 deletions

View File

@@ -16,9 +16,11 @@ import (
)
const (
dockerConf = "/var/lib/rancher/conf/docker"
dockerDone = "/run/docker-done"
dockerLog = "/var/log/docker.log"
dockerConf = "/var/lib/rancher/conf/docker"
dockerDone = "/run/docker-done"
dockerLog = "/var/log/docker.log"
dockerCompletionLinkFile = "/usr/share/bash-completion/completions/docker"
dockerCompletionFile = "/var/lib/rancher/engine/completion"
)
func dockerInitAction(c *cli.Context) error {
@@ -30,6 +32,12 @@ func dockerInitAction(c *cli.Context) error {
time.Sleep(200 * time.Millisecond)
}
if _, err := os.Stat(dockerCompletionFile); err != nil {
if _, err := os.Readlink(dockerCompletionLinkFile); err == nil {
syscall.Unlink(dockerCompletionLinkFile)
}
}
dockerBin := ""
dockerPaths := []string{
"/usr/bin",