create_relay.go 517 B

12345678910111213141516171819202122
  1. package host
  2. import (
  3. "strings"
  4. "github.com/gravitl/netmaker/cli/functions"
  5. "github.com/spf13/cobra"
  6. )
  7. var hostCreateRelayCmd = &cobra.Command{
  8. Use: "create_relay [HOST ID] [RELAYED HOST IDS (comma separated)]",
  9. Args: cobra.ExactArgs(2),
  10. Short: "Turn a Host into a Relay",
  11. Long: `Turn a Host into a Relay`,
  12. Run: func(cmd *cobra.Command, args []string) {
  13. functions.PrettyPrint(functions.CreateRelay(args[0], strings.Split(args[1], ",")))
  14. },
  15. }
  16. func init() {
  17. rootCmd.AddCommand(hostCreateRelayCmd)
  18. }