<commit_before>package main

import (
	"fmt"
	"strings"
	"os"
	"flag"
	"io/ioutil"
)

func appendSource(element string) string {
	sourcesToSearch := []string {"/etc/paths"}
	for _, source := range sourcesToSearch {
		    b, err := ioutil.ReadFile(source)
		    if err != nil {
		        panic(err)
		    }

		    if strings.Contains(string(b), element) {
		    	return element + " set by: " + source
		    }
	}
	return element
}

func returnPath(shouldList, detailedList bool) {
	if !(shouldList || detailedList) {
		fmt.Println(os.Getenv("PATH"))
		return
	}

	pathList := strings.Split(os.Getenv("PATH"), ":")
	for _, p := range pathList {
		if detailedList {
			p = appendSource(p)
		}

		fmt.Println(p)
	}
}

func main() {
	useList := flag.Bool("l", false, "use a long listing format")
	detailedList := flag.Bool("d", false, "use a (detailed) long listing format")

	flag.Parse()
	returnPath(*useList, *detailedList)
}<commit_msg>Added Ubuntu support for detailed list.<commit_after>package main

import (
	"flag"
	"fmt"
	"io/ioutil"
	"os"
	"runtime"
	"strings"
)

func getSearchSources() []string {
	// OS X
	if runtime.GOOS == "darwin" {
		return []string{"/etc/paths"}
	}

	// Ubuntu
	home := os.Getenv("HOME")
	bashrc := home + "/.bashrc"
	bashprofile := home + "/.bash_profile"
	profile := home + "/.profile"
	env := "/etc/environment"

	return []string{bashrc, bashprofile, profile, env}
}

func appendSource(element string) string {
	for _, source := range getSearchSources() {
		b, err := ioutil.ReadFile(source)
		if err != nil {
			panic(err)
		}

		if strings.Contains(string(b), element) {
			return element + " set by: " + source
		}
	}
	return element
}

func returnPath(shouldList, detailedList bool) {
	if !(shouldList || detailedList) {
		fmt.Println(os.Getenv("PATH"))
		return
	}

	pathList := strings.Split(os.Getenv("PATH"), ":")
	for _, p := range pathList {
		if detailedList {
			p = appendSource(p)
		}

		fmt.Println(p)
	}
}

func main() {
	useList := flag.Bool("l", false, "use a long listing format")
	detailedList := flag.Bool("d", false, "use a (detailed) long listing format")

	flag.Parse()
	returnPath(*useList, *detailedList)
}
{'fraction_non_alphanumeric': 0.1602771362586605, 'fraction_numerical': 0.0, 'mean_word_length': 3.5889830508474576, 'pattern_counts': {'":': 2, '<': 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': '38613', 'n_tokens_mistral': 832, 'n_tokens_neox': 772, 'n_words': 188}