29 lines
656 B
Go
29 lines
656 B
Go
package cmd
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"github.com/JanikL/go-artemis/artemis"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var addLinkCmd = &cobra.Command{
|
|
Use: "add-link",
|
|
Short: "Add Link",
|
|
Long: "Add Link to Kontor Database",
|
|
Args: cobra.ExactArgs(1),
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
slog.Info("add-link kontor started")
|
|
sender := artemis.Sender{Addr: "localhost:61616", Dest: "add-link", Enc: artemis.EncodingJson}
|
|
err := sender.Send("{ \"url\": \"https://example.com\" }")
|
|
if err != nil {
|
|
slog.Info("send failed", "error", err.Error())
|
|
}
|
|
slog.Info("add-link kontor finished")
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(addLinkCmd)
|
|
}
|