frequencyPlan, err := cmd.Flags().GetString("frequency-plan")
		if err != nil {
			ctx.WithError(err).Fatal("Invalid frequency-plan")
		}

		if frequencyPlan != "" {
			edits.FrequencyPlan = frequencyPlan
		}

		locationStr, err := cmd.Flags().GetString("location")
		if err != nil {
			ctx.WithError(err).Fatal("Invalid location")
		}

		if locationStr != "" {
			location, err := util.ParseLocation(locationStr)
			if err != nil {
				ctx.WithError(err).Fatal("Invalid location")
			}
			edits.Location = location
		}

		act := util.GetAccount(ctx)
		err = act.EditGateway(gatewayID, edits)
		if err != nil {
			ctx.WithError(err).Fatal("Failure editing gateway")
		}

		ctx.WithField("Gateway ID", gatewayID).Info("Edited gateway")
	},
}
		if len(args) != 2 && len(args) != 3 {
			cmd.UsageFunc()(cmd)
			return
		}

		gatewayID := args[0]
		if !api.ValidID(gatewayID) {
			ctx.Fatal("Invalid Gateway ID")
		}

		frequencyPlan := args[1]

		var err error
		var location *account.Location
		if len(args) == 3 {
			location, err = util.ParseLocation(args[2])
			if err != nil {
				ctx.WithError(err).Fatal("Invalid location")
			}
		}

		act := util.GetAccount(ctx)
		gateway, err := act.RegisterGateway(gatewayID, frequencyPlan, location)
		if err != nil {
			ctx.WithError(err).Fatal("Could not register gateway")
		}

		util.ForceRefreshToken(ctx)

		ctx.WithField("Gateway ID", gateway.ID).Info("Registered Gateway")
	},