Skip to content

Commit 17dde5a

Browse files
authored
fix bash completion on ubuntu by sourcing /etc/bash_completion (#337)
1 parent a03055d commit 17dde5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/embedded-cluster/shell.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ var shellCommand = &cli.Command{
8585
config = "source <(kubectl completion $(basename ${SHELL}))\n"
8686
_, _ = shellpty.WriteString(config)
8787
_, _ = io.CopyN(io.Discard, shellpty, int64(len(config)+1))
88+
// if /etc/bash_completion is present, source it
89+
if _, err := os.Stat("/etc/bash_completion"); err == nil {
90+
config = "source /etc/bash_completion\n"
91+
_, _ = shellpty.WriteString(config)
92+
_, _ = io.CopyN(io.Discard, shellpty, int64(len(config)+1))
93+
}
94+
8895
go func() { _, _ = io.Copy(shellpty, os.Stdin) }()
8996
go func() { _, _ = io.Copy(os.Stdout, shellpty) }()
9097
_ = shell.Wait()

0 commit comments

Comments
 (0)