ntfy-server/main.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.1 KiB
Go
Raw Normal View History

2021-10-22 18:54:02 -04:00
package main
import (
"fmt"
"github.com/urfave/cli/v2"
2025-08-07 16:41:39 +02:00
"go/build"
2023-11-16 20:54:58 -05:00
"heckel.io/ntfy/v2/cmd"
"os"
"runtime"
2025-08-07 16:41:39 +02:00
"strings"
)
var (
version = "dev"
commit = "unknown"
date = "unknown"
2021-10-22 18:54:02 -04:00
)
func main() {
2025-08-07 16:41:39 +02:00
cli.AppHelpTemplate += buildHelp()
app := cmd.New()
app.Version = version
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
2021-10-22 18:54:02 -04:00
}
}
2025-08-07 16:41:39 +02:00
func buildHelp() string {
if len(commit) > 7 {
commit = commit[:7]
}
var tags string
if len(build.Default.BuildTags) > 0 {
tags = ", with tags " + strings.Join(build.Default.BuildTags, ", ")
}
return fmt.Sprintf(`
Try 'ntfy COMMAND --help' or https://ntfy.sh/docs/ for more information.
To report a bug, open an issue on GitHub: https://github.com/binwiederhier/ntfy/issues.
If you want to chat, simply join the Discord server (https://discord.gg/cT7ECsZj9w), or
the Matrix room (https://matrix.to/#/#ntfy:matrix.org).
ntfy %s (%s), runtime %s, built at %s%s
Copyright (C) Philipp C. Heckel, licensed under Apache License 2.0 & GPLv2
`, version, commit, runtime.Version(), date, tags)
}