feat: support title flag on cli (#172)

This commit is contained in:
Bo-Yi Wu 2017-01-21 15:46:44 +08:00 committed by GitHub
parent 9bd6886c1e
commit 2a00ed77ad
1 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,7 @@ Server Options:
-c, --config <file> Configuration file path -c, --config <file> Configuration file path
-m, --message <message> Notification message -m, --message <message> Notification message
-t, --token <token> Notification token -t, --token <token> Notification token
--title <title> Notification title
--proxy <proxy> Proxy URL (only for GCM) --proxy <proxy> Proxy URL (only for GCM)
--pid <pid path> Process identifier path --pid <pid path> Process identifier path
iOS Options: iOS Options:
@ -98,6 +99,7 @@ func main() {
var message string var message string
var token string var token string
var proxy string var proxy string
var title string
flag.BoolVar(&showVersion, "version", false, "Print version information.") flag.BoolVar(&showVersion, "version", false, "Print version information.")
flag.BoolVar(&showVersion, "v", false, "Print version information.") flag.BoolVar(&showVersion, "v", false, "Print version information.")
@ -116,6 +118,7 @@ func main() {
flag.StringVar(&token, "token", "", "token string") flag.StringVar(&token, "token", "", "token string")
flag.StringVar(&message, "m", "", "notification message") flag.StringVar(&message, "m", "", "notification message")
flag.StringVar(&message, "message", "", "notification message") flag.StringVar(&message, "message", "", "notification message")
flag.StringVar(&title, "title", "", "notification title")
flag.BoolVar(&opts.Android.Enabled, "android", false, "send android notification") flag.BoolVar(&opts.Android.Enabled, "android", false, "send android notification")
flag.BoolVar(&opts.Ios.Enabled, "ios", false, "send ios notification") flag.BoolVar(&opts.Ios.Enabled, "ios", false, "send ios notification")
flag.BoolVar(&opts.Ios.Production, "production", false, "production mode in iOS") flag.BoolVar(&opts.Ios.Production, "production", false, "production mode in iOS")
@ -198,6 +201,7 @@ func main() {
Tokens: []string{token}, Tokens: []string{token},
Platform: gorush.PlatFormAndroid, Platform: gorush.PlatFormAndroid,
Message: message, Message: message,
Title: title,
} }
err := gorush.CheckMessage(req) err := gorush.CheckMessage(req)
@ -223,6 +227,7 @@ func main() {
Tokens: []string{token}, Tokens: []string{token},
Platform: gorush.PlatFormIos, Platform: gorush.PlatFormIos,
Message: message, Message: message,
Title: title,
} }
if topic != "" { if topic != "" {