2019-07-21 02:00:04 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2019-08-17 21:10:48 +00:00
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
2019-07-21 02:00:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// completionCmd represents the completion command
|
|
|
|
var completionCmd = &cobra.Command{
|
|
|
|
Use: "completion",
|
2019-08-17 21:10:48 +00:00
|
|
|
Short: "Generate Bash completion scripts",
|
|
|
|
Example: ` Load completions in the current Bash shell:
|
|
|
|
. <(psu completion)
|
2019-07-21 02:00:04 +00:00
|
|
|
|
2019-08-17 21:10:48 +00:00
|
|
|
Configure Bash shell to load completions for each session:
|
|
|
|
# ~/.bashrc or ~/.profile
|
|
|
|
. <(psu completion)`,
|
2019-07-21 02:00:04 +00:00
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
rootCmd.GenBashCompletion(os.Stdout)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(completionCmd)
|
|
|
|
}
|