list.go 625 B

123456789101112131415161718192021222324252627
  1. package ext_client
  2. import (
  3. "github.com/gravitl/netmaker/cli/functions"
  4. "github.com/spf13/cobra"
  5. )
  6. var networkName string
  7. var extClientListCmd = &cobra.Command{
  8. Use: "list",
  9. Args: cobra.NoArgs,
  10. Short: "List External Clients",
  11. Long: `List External Clients`,
  12. Run: func(cmd *cobra.Command, args []string) {
  13. if networkName != "" {
  14. functions.PrettyPrint(functions.GetNetworkExtClients(networkName))
  15. } else {
  16. functions.PrettyPrint(functions.GetAllExtClients())
  17. }
  18. },
  19. }
  20. func init() {
  21. extClientListCmd.Flags().StringVar(&networkName, "network", "", "Network name")
  22. rootCmd.AddCommand(extClientListCmd)
  23. }