mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-06-16 17:43:13 +02:00
WIP CLI
This commit is contained in:
parent
5639cf7a0f
commit
f266afa1de
12 changed files with 209 additions and 74 deletions
cmd
|
@ -46,7 +46,7 @@ func execPublish(c *cli.Context) error {
|
|||
delay := c.String("delay")
|
||||
noCache := c.Bool("no-cache")
|
||||
noFirebase := c.Bool("no-firebase")
|
||||
topicURL := expandTopicURL(c.Args().Get(0))
|
||||
topic := c.Args().Get(0)
|
||||
message := ""
|
||||
if c.NArg() > 1 {
|
||||
message = strings.Join(c.Args().Slice()[1:], " ")
|
||||
|
@ -70,5 +70,10 @@ func execPublish(c *cli.Context) error {
|
|||
if noFirebase {
|
||||
options = append(options, client.WithNoFirebase())
|
||||
}
|
||||
return client.DefaultClient.Publish(topicURL, message, options...)
|
||||
conf, err := loadConfig(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cl := client.New(conf)
|
||||
return cl.Publish(topic, message, options...)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue