github.com/taubyte/tau-cli@v0.1.13-0.20240326000942-487f0d57edfc/cli/commands/autocomplete/command.go (about)

     1  package autocomplete
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"path/filepath"
     7  
     8  	_ "embed"
     9  
    10  	"github.com/urfave/cli/v2"
    11  )
    12  
    13  var (
    14  	//go:embed bash_autocomplete.sh
    15  	script string
    16  
    17  	Command = &cli.Command{
    18  		Name:   "autocomplete",
    19  		Usage:  "Used with eval or in .bashrc for autocompletion",
    20  		Action: Run,
    21  	}
    22  )
    23  
    24  func Run(ctx *cli.Context) error {
    25  	basePath := filepath.Base(os.Args[0])
    26  
    27  	fmt.Println(script + basePath)
    28  
    29  	return nil
    30  }