-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
54 lines (44 loc) · 1.12 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
_ "embed"
"log"
"github.com/hrntknr/ntf/backends"
"github.com/spf13/cobra"
)
func main() {
if err := _main(); err != nil {
log.Fatal(err)
}
}
//go:embed ntf-shell-hook.sh
var ntf_shell_hook []byte
func _main() error {
cmd := &cobra.Command{}
cmd.CompletionOptions.DisableDefaultCmd = true
doneCmd := &cobra.Command{
Use: "done",
Short: "Execute the command and notify the message",
Run: doneFunc,
}
doneCmd.Flags().StringP("title", "t", "", "override title")
sendCmd := &cobra.Command{
Use: "send",
Short: "send notification",
Run: sendFunc,
}
sendCmd.Flags().StringP("title", "t", "", "override title")
shellDoneCmd := &cobra.Command{
Use: "shell-done",
Hidden: true,
Run: shellDoneFunc,
}
shellDoneCmd.Flags().StringP("title", "t", "", "override title")
shellIntegrationCmd := &cobra.Command{
Use: "shell-integration",
Short: "shell-integration",
Run: shellIntegrationFunc,
}
backends.RegisterFlags(doneCmd, sendCmd, shellIntegrationCmd, shellDoneCmd)
cmd.AddCommand(doneCmd, sendCmd, shellIntegrationCmd, shellDoneCmd)
return cmd.Execute()
}