Exemplo n.º 1
0
func Test_Green_1(t *testing.T) {
	expected := "\x1b[32mpolru\x1b[39;49m"
	actual := Color.Green("polru", true)
	if actual != expected {
		t.Errorf("Test failed, expected: '%s', got: '%s'", expected, actual)
	}
}
Exemplo n.º 2
0
func Test_Green_2(t *testing.T) {
	expected := "polru"
	actual := Color.Green("polru", false)
	if actual != expected {
		t.Errorf("Test failed, expected: '%s', got: '%s'", expected, actual)
	}
}
Exemplo n.º 3
0
func printMentionsByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, mention := range tweet.Mentions {
			fmt.Println("", tweet.Date, Color.Green(mention, color))
		}
	}
}
Exemplo n.º 4
0
func printUriByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, uri := range tweet.Uri {
			fmt.Println("", tweet.Date, Color.Green(uri, color))
		}
	}
}
Exemplo n.º 5
0
func printMediaByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, media := range tweet.Media {
			fmt.Println("", tweet.Date, Color.Green(media, color))
		}
	}
}
Exemplo n.º 6
0
func printHashtagsByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, hashtag := range tweet.Hashtags {
			fmt.Println("", tweet.Date, Color.Green(hashtag, color))
		}
	}
}
Exemplo n.º 7
0
func printSummary(user anaconda.User, color bool) {
	fmt.Print(" ", user.Name)
	fmt.Printf("(%s)", Color.Blue(user.ScreenName, color))
	fmt.Print("     id:", Color.Blue(user.IdStr, color))
	fmt.Print("\n")
	fmt.Print(" ", user.Name)
	if user.GeoEnabled {
		fmt.Printf(" has geolocation %s\n", Color.Green("enabled", color))
	} else {
		fmt.Printf(" has geolocation %s\n", Color.Magenta("disabled", color))
	}
	locale := ""
	location := user.Location
	if "" != location {
		locale += "Location:  " + Color.Green(location, color) + ";     "
	}
	timezone := user.TimeZone
	if "" != timezone {
		locale += "Timezone: " + Color.Green(timezone, color) + ";     "
	}
	language := user.Lang
	if "" != language {
		locale += "Language: " + Color.Green(language, color) + ";"
	}
	if "" != locale {
		fmt.Printf(" %s\n", locale)
	}
	fmt.Printf(" Created: %s\n", Color.Green(user.CreatedAt, color))
	fmt.Printf(" URL: %s\n", Color.Yellow(user.URL, color))
	fmt.Printf(" Profile Image: %s\n", Color.Yellow(user.ProfileImageURL, color))
	fmt.Printf(" %v favorites;     %v friends;     %v followers;\n", user.FriendsCount, user.FavouritesCount, user.FollowersCount)
	fmt.Printf(" Member of %v public lists\n", user.ListedCount)
	numberOfTweets := user.StatusesCount
	fmt.Printf(" Number of Tweets: %v\n", numberOfTweets)
	if numberOfTweets > 0 {
		fmt.Printf(" Most Recent Tweet: %s\n", user.Status.Text)
	}
}
Exemplo n.º 8
0
func printEntitiesByFrequency(entities map[string]int, prefix string, color bool) {
	for _, key := range SortedMap.SortedKeys(entities) {
		fmt.Printf(" %-9v  %s\n", entities[key], Color.Green(prefix+key, color))
	}
}
Exemplo n.º 9
0
func printGeolocationByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		if tweet.Locatable {
			fmt.Printf(" %s  (%s)%s,%s within %v\n", tweet.Date, Color.Cyan(tweet.PlaceType, color), Color.Green(tweet.Place, color), Color.Green(tweet.Country, color), tweet.Location)
		}
	}
}