#59 fix gorush gocyclo error.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-04-16 17:11:31 +08:00
parent 0f09f5c851
commit 21e11b01db
1 changed files with 12 additions and 13 deletions

View File

@ -6,6 +6,16 @@ import (
"log"
)
func checkInput(token, message string) {
if len(token) == 0 {
gorush.LogError.Fatal("Missing token flag (-t)")
}
if len(message) == 0 {
gorush.LogError.Fatal("Missing message flag (-m)")
}
}
func main() {
version := flag.Bool("v", false, "gorush version")
confPath := flag.String("c", "", "yaml configuration file path for gorush")
@ -62,13 +72,8 @@ func main() {
// send android notification
if *android {
if len(*token) == 0 {
gorush.LogError.Fatal("Missing token flag (-t)")
}
if len(*message) == 0 {
gorush.LogError.Fatal("Missing message flag (-m)")
}
checkInput(*token, *message)
gorush.PushConf.Android.Enabled = true
req := gorush.PushNotification{
@ -85,13 +90,7 @@ func main() {
// send android notification
if *ios {
if len(*token) == 0 {
gorush.LogError.Fatal("Missing token flag (-t)")
}
if len(*message) == 0 {
gorush.LogError.Fatal("Missing message flag (-m)")
}
checkInput(*token, *message)
if *production {
gorush.PushConf.Ios.Production = true