use.go 395 B

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