mirror of
https://github.com/sstent/go-garth-cli.git
synced 2026-01-26 17:12:05 +00:00
sync
This commit is contained in:
38
python-garmin-connect/connect/completion.go
Normal file
38
python-garmin-connect/connect/completion.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
completionCmd := &cobra.Command{
|
||||
Use: "completion",
|
||||
}
|
||||
rootCmd.AddCommand(completionCmd)
|
||||
|
||||
completionBashCmd := &cobra.Command{
|
||||
Use: "bash",
|
||||
Short: "Output command completion for Bourne Again Shell (bash)",
|
||||
RunE: completionBash,
|
||||
Args: cobra.NoArgs,
|
||||
}
|
||||
completionCmd.AddCommand(completionBashCmd)
|
||||
|
||||
completionZshCmd := &cobra.Command{
|
||||
Use: "zsh",
|
||||
Short: "Output command completion for Z Shell (zsh)",
|
||||
RunE: completionZsh,
|
||||
Args: cobra.NoArgs,
|
||||
}
|
||||
completionCmd.AddCommand(completionZshCmd)
|
||||
}
|
||||
|
||||
func completionBash(_ *cobra.Command, _ []string) error {
|
||||
return rootCmd.GenBashCompletion(os.Stdout)
|
||||
}
|
||||
|
||||
func completionZsh(_ *cobra.Command, _ []string) error {
|
||||
return rootCmd.GenZshCompletion(os.Stdout)
|
||||
}
|
||||
Reference in New Issue
Block a user