<commit_before>package main

import (
	"fmt"
	"github.com/GeertJohan/go.hue"
)

func main() {
	fmt.Println("Welcome to huexamlpe")

	bbds, err := hue.DiscoverBridges()
	if err != nil {
		fmt.Println("Error while discovering bridges:", err)
		return
	}

	if len(bbds) == 0 {
		fmt.Println("No bridge details found. Stopping.")
		return
	}

	fmt.Printf("Found %d bridges:\n", len(bbds))

	for idx, bbd := range bbds {
		fmt.Printf("%d: %#v\n", idx, bbd)
	}

	fmt.Printf("Continueing with first bridge found, id: %s\n", bbds[0].ID)

	fmt.Println("Going to create user 'newdeveloper':")
	bridge1 := hue.NewBridge(bbds[0].InternalIPAddress)
	newUsername, err := bridge1.CreateNewUser("huexample", "newdeveloper")
	if err != nil {
		fmt.Printf("have error: %s\n", err)
		return
	}
	fmt.Printf("Successfully created new user. Got username: %s\n", newUsername)

	fmt.Println("Going to create user with empty username:")
	bridge2 := hue.NewBridge(bbds[0].InternalIPAddress)
	newUsername, err = bridge2.CreateNewUser("huexample", "")
	if err != nil {
		fmt.Printf("have error: %s\n", err)
		return
	}
	fmt.Printf("Successfully created new user. Got username: %s\n", newUsername)

	bridge2.Username = newUsername
}
<commit_msg>Better var names in huexample Fixed typo in welcome message.<commit_after>package main

import (
	"fmt"
	"github.com/GeertJohan/go.hue"
)

func main() {
	fmt.Println("Welcome to huexample")

	brokerDetailsSlice, err := hue.DiscoverBridges()
	if err != nil {
		fmt.Println("Error while discovering bridges:", err)
		return
	}

	if len(brokerDetailsSlice) == 0 {
		fmt.Println("No bridge details found. Stopping.")
		return
	}

	fmt.Printf("Found %d bridges:\n", len(brokerDetailsSlice))

	for idx, brokerDetails := range brokerDetailsSlice {
		fmt.Printf("%d: %#v\n", idx, brokerDetails)
	}

	fmt.Printf("Continueing with first bridge found, id: %s\n", brokerDetailsSlice[0].ID)

	fmt.Println("Going to create user with empty username, bridge will generate a username.")
	bridge := hue.NewBridge(brokerDetailsSlice[0].InternalIPAddress)
	newUsername, err := bridge.CreateNewUser("huexample", "")
	if err != nil {
		fmt.Printf("have error: %s\n", err)
		return
	}
	fmt.Printf("Successfully created new user. Got username: %s\n", newUsername)

	// update the Username field on Bridge instance with the user we just created
	bridge.Username = newUsername
}

{'fraction_non_alphanumeric': 0.14309835373575347, 'fraction_numerical': 0.005065428450823132, 'mean_word_length': 4.511627906976744, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3779794', 'n_tokens_mistral': 876, 'n_tokens_neox': 819, 'n_words': 218}