<commit_before>package main

import (
	"fmt"
	"os"
	"text/tabwriter"
	"github.com/rackspace/gophercloud/openstack/compute/servers"
	"github.com/rackspace/gophercloud/openstack/identity"
	"github.com/rackspace/gophercloud/openstack/utils"
)

func main() {
	ao, err := utils.AuthOptions()
	if err != nil {
		panic(err)
	}

	a, err := identity.Authenticate(ao)
	if err != nil {
		panic(err)
	}

	sc, err := identity.GetServiceCatalog(a)
	if err != nil {
		panic(err)
	}

	eps, err := findAllComputeEndpoints(sc)
	if err != nil {
		panic(err)
	}

	n := 0
	w := new(tabwriter.Writer)
	w.Init(os.Stdout, 2, 8, 2, ' ', 0)
	fmt.Fprintln(w, "ID\tName\tRegion\tIPv4\tIPv6\t")
	for _, ep := range eps {
		client := servers.NewClient(ep.PublicURL, a, ao)

		listResults, err := servers.List(client)
		if err != nil {
			panic(err)
		}

		svrs, err := servers.GetServers(listResults)
		if err != nil {
			panic(err)
		}

		n = n + len(svrs)

		for _, s := range svrs {
			fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t\n", s.Id, s.Name, ep.Region, s.AccessIPv4, s.AccessIPv6)
		}<commit_msg>Add support for region name<commit_after>package main

import (
	"fmt"
	"os"
	"text/tabwriter"
	"github.com/rackspace/gophercloud/openstack/compute/servers"
	"github.com/rackspace/gophercloud/openstack/identity"
	"github.com/rackspace/gophercloud/openstack/utils"
)

func main() {
	ao, err := utils.AuthOptions()
	if err != nil {
		panic(err)
	}

	a, err := identity.Authenticate(ao)
	if err != nil {
		panic(err)
	}

	sc, err := identity.GetServiceCatalog(a)
	if err != nil {
		panic(err)
	}

	eps, err := findAllComputeEndpoints(sc)
	if err != nil {
		panic(err)
	}

	region := os.Getenv("OS_REGION_NAME")

	n := 0
	w := new(tabwriter.Writer)
	w.Init(os.Stdout, 2, 8, 2, ' ', 0)
	fmt.Fprintln(w, "ID\tName\tRegion\tIPv4\tIPv6\t")
	for _, ep := range eps {
		if (region != "") && (region != ep.Region) {
			continue
		}

		client := servers.NewClient(ep.PublicURL, a, ao)

		listResults, err := servers.List(client)
		if err != nil {
			panic(err)
		}

		svrs, err := servers.GetServers(listResults)
		if err != nil {
			panic(err)
		}

		n = n + len(svrs)

		for _, s := range svrs {
			fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t\n", s.Id, s.Name, ep.Region, s.AccessIPv4, s.AccessIPv6)
		}
{'fraction_non_alphanumeric': 0.17391304347826086, 'fraction_numerical': 0.007985803016858917, 'mean_word_length': 3.395711500974659, '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': '2967267', 'n_tokens_mistral': 1028, 'n_tokens_neox': 957, 'n_words': 183}