Created
April 17, 2016 09:57
-
-
Save nguyenvanduocit/779f56f5e3ec3110d89c4eedc0361bad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"github.com/nguyenvanduocit/gohoro" | |
) | |
func main() { | |
var signName string | |
flag.StringVar(&signName, "sign", "", "Sign name") | |
flag.Parse() | |
if signName == "" { | |
var signId int = -1 | |
for k, v := range gohoro.SignMap { | |
fmt.Println(k, "--", v) | |
} | |
isFirst:=true | |
for signName == ""{ | |
if !isFirst{ | |
fmt.Print("This sign is not exist, please type a number from the list below :") | |
}else{ | |
isFirst = false; | |
fmt.Print("Please choose a horoscope (number):") | |
} | |
fmt.Scanf("%d", &signId) | |
if signId==0{ | |
return | |
} | |
signName = gohoro.GetSignNameById(signId) | |
} | |
} | |
fmt.Println("Please wait ...") | |
content, err := gohoro.GetHoroscope(signName) | |
if err != nil { | |
fmt.Println(err) | |
} | |
fmt.Println(content) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment