Example #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)
	}
}
Example #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)
	}
}
func printMentionsByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, mention := range tweet.Mentions {
			fmt.Println("", tweet.Date, Color.Green(mention, color))
		}
	}
}
func printUriByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, uri := range tweet.Uri {
			fmt.Println("", tweet.Date, Color.Green(uri, color))
		}
	}
}
func printMediaByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, media := range tweet.Media {
			fmt.Println("", tweet.Date, Color.Green(media, color))
		}
	}
}
func printHashtagsByDate(tweets []Tweet, color bool) {
	for _, tweet := range tweets {
		for _, hashtag := range tweet.Hashtags {
			fmt.Println("", tweet.Date, Color.Green(hashtag, color))
		}
	}
}
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)
	}
}
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))
	}
}
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)
		}
	}
}