get.go 668 B

123456789101112131415161718192021222324252627
  1. package network_user
  2. import (
  3. "github.com/gravitl/netmaker/cli/functions"
  4. "github.com/spf13/cobra"
  5. )
  6. var data bool
  7. var networkuserGetCmd = &cobra.Command{
  8. Use: "get [NETWORK NAME] [NETWORK USER NAME]",
  9. Args: cobra.ExactArgs(2),
  10. Short: "Fetch a network user",
  11. Long: `Fetch a network user`,
  12. Run: func(cmd *cobra.Command, args []string) {
  13. if data {
  14. functions.PrettyPrint(functions.GetNetworkUserData(args[1]))
  15. } else {
  16. functions.PrettyPrint(functions.GetNetworkUser(args[0], args[1]))
  17. }
  18. },
  19. }
  20. func init() {
  21. networkuserGetCmd.Flags().BoolVar(&data, "data", false, "Fetch entire data of a network user")
  22. rootCmd.AddCommand(networkuserGetCmd)
  23. }