func UnsubscribeTopicCommand(e4Client e4.Client, mqttClient mqtt.Client, l logger.Logger) *Command {
	return &Command{
		Name:     "unsubscribe",
		Help:     "unsubscribe from a topic",
		ArgsHelp: "<topicName>",
		Func: func(args []string) {
			if len(args) != 1 {
				l.Print("Usage: unsubscribe <topicName>")
				return
			}
			token := mqttClient.Unsubscribe(args[0])
			if err := token.Error(); err != nil {
				l.Errorf("got mqtt subscribe error: %v", err)
				return
			}
			if !token.WaitTimeout(time.Second) {
				l.Error("got timeout waiting for mqtt reply")
				return
			}
			l.Printf("success unsubscribing from topic '%s'", args[0])
		},
	}
}
UnsubscribeTopicCommand creates a command to unsubscribe from MQTT topics
package commands
import (
	"strings"
	"time"
	"golang.org/x/crypto/ed25519"
	mqtt "github.com/eclipse/paho.mqtt.golang"
	tui "github.com/marcusolsson/tui-go"
	e4 "github.com/teserakt-io/e4go"
	e4crypto "github.com/teserakt-io/e4go/crypto"
	"github.com/teserakt-io/e4go/cmd/e4client/logger"
)
type Command struct {
	Name     string
	Help     string
	ArgsHelp string
	Func     func([]string)
}
func SubscribeTopicCommand(e4Client e4.Client, mqttClient mqtt.Client, l logger.Logger) *Command {
	return &Command{
		Name:     "subscribe",
		Help:     "subscribe to a topic",
		ArgsHelp: "<topicName>",
		Func: func(args []string) {
			if len(args) != 1 {
				l.Print("Usage: subscribe <topicName>")
				return
			}
			token := mqttClient.Subscribe(args[0], 2, func(client mqtt.Client, msg mqtt.Message) {
				unprotected, err := e4Client.Unprotect(msg.Payload(), msg.Topic())
				if err != nil {
					l.Errorf("failed to unprotect E4 message on topic %s: %v", msg.Topic(), err)
					return
				}
				l.Printf("< [%s] %s", msg.Topic(), unprotected)
			})
			if err := token.Error(); err != nil {
				l.Errorf("got mqtt subscribe error: %v", err)
				return
			}
			if !token.WaitTimeout(time.Second) {
				l.Error("got timeout waiting for mqtt reply")
				return
			}
			l.Printf("success subscribing to topic '%s'", args[0])
		},
	}
}