use.go 437 B

123456789101112131415161718192021
  1. package context
  2. import (
  3. "github.com/gravitl/netmaker/cli/config"
  4. "github.com/spf13/cobra"
  5. )
  6. // contextUseCmd sets the current context
  7. var contextUseCmd = &cobra.Command{
  8. Use: "use [NAME]",
  9. Args: cobra.ExactArgs(1),
  10. Short: "Set the current context",
  11. Long: `Set the current context`,
  12. Run: func(cmd *cobra.Command, args []string) {
  13. config.SetCurrentContext(args[0])
  14. },
  15. }
  16. func init() {
  17. rootCmd.AddCommand(contextUseCmd)
  18. }