tailscale/tempfork/spf13/cobra
Paul Scott 82394debb7 cmd/tailscale: add shell tab-completion
The approach is lifted from cobra: `tailscale completion bash` emits a bash
script for configuring the shell's autocomplete:

    . <( tailscale completion bash )

so that typing:

    tailscale st<TAB>

invokes:

    tailscale completion __complete -- st

RELNOTE=tailscale CLI now supports shell tab-completion

Fixes #3793

Signed-off-by: Paul Scott <paul@tailscale.com>
2024-04-17 18:54:10 +01:00
..
LICENSE.txt cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
README.md cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
cobra.go cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.bash cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.bash.gz cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.fish cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.fish.gz cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.go cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.ps1 cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.ps1.gz cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.zsh cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
comp.zsh.gz cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00
gen.go cmd/tailscale: add shell tab-completion 2024-04-17 18:54:10 +01:00

README.md

github.com/spf13/cobra

This package contains a copy of the Apache 2.0-licensed shell scripts that Cobra uses to integrate tab-completion into bash, zsh, fish and powershell, and the constants that interface with them. We are re-using these scripts to implement similar tab-completion for ffcli and the standard library flag package.

The shell scripts were Go constants in the Cobra code, but we have extracted them into separate files to facilitate gzipping them, and have removed the activeHelp functionality from them.