<commit_before>package main

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

const GH = "https://github.com/"

func clone(bundle string, home string) string {
	folder := home + strings.Replace(bundle, "/", "-", -1)
	if _, err := os.Stat(folder); os.IsNotExist(err) {
		clone := exec.Command("git", "clone", "--depth", "1", GH+bundle, folder)
		clone.Start()
	}
	return folder
}

func pull(bundle string, home string) string {
	folder := home + bundle
	pull := exec.Command("git", "-C", folder, "pull", "origin", "master")
	pull.Start()
	return folder
}

func update(home string) {
	bundles, _ := ioutil.ReadDir(home)
	for _, bundle := range bundles {
		if bundle.Mode().IsDir() && bundle.Name()[0] != '.' {
			fmt.Println(pull(home+bundle.Name(), home))
		}
	}
}

func main() {
	home := os.Getenv("HOME") + "/.antibody/"
	stat, _ := os.Stdin.Stat()
	if (stat.Mode() & os.ModeCharDevice) == 0 {
		bundles, _ := ioutil.ReadAll(os.Stdin)
		for _, bundle := range strings.Split(string(bundles), "\n") {
			if bundle != "" {
				fmt.Println(clone(bundle, home))
			}
		}
	} else {
		if (os.Args[1:][0]) == "update" {
			update(home)
		} else if (os.Args[1:][0]) == "bundle" {
			fmt.Println(clone(os.Args[1:][1], home))
		}
	}
}<commit_msg>improved code<commit_after>package main

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

const GH = "https://github.com/"

func clone(bundle string, home string) string {
	folder := home + strings.Replace(bundle, "/", "-", -1)
	if _, err := os.Stat(folder); os.IsNotExist(err) {
		clone := exec.Command("git", "clone", "--depth", "1", GH+bundle, folder)
		clone.Start()
	}
	return folder
}

func cloneStdin(home string) {
	bundles, _ := ioutil.ReadAll(os.Stdin)
	for _, bundle := range strings.Split(string(bundles), "\n") {
		if bundle != "" {
			fmt.Println(clone(bundle, home))
		}
	}
}

func pull(bundle string, home string) string {
	folder := home + bundle
	pull := exec.Command("git", "-C", folder, "pull", "origin", "master")
	pull.Start()
	return folder
}

func update(home string) {
	bundles, _ := ioutil.ReadDir(home)
	for _, bundle := range bundles {
		if bundle.Mode().IsDir() && bundle.Name()[0] != '.' {
			fmt.Println(pull(home+bundle.Name(), home))
		}
	}
}

func readStdin() bool {
	stat, _ := os.Stdin.Stat()
	return (stat.Mode() & os.ModeCharDevice) == 0
}

func main() {
	home := os.Getenv("HOME") + "/.antibody/"
	if readStdin() {
		cloneStdin(home)
	} else {
		if (os.Args[1:][0]) == "update" {
			update(home)
		} else if (os.Args[1:][0]) == "bundle" {
			fmt.Println(clone(os.Args[1:][1], home))
		}
	}
}
{'fraction_non_alphanumeric': 0.21406491499227204, 'fraction_numerical': 0.0077279752704791345, 'mean_word_length': 3.6902173913043477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '267309', 'n_tokens_mistral': 1064, 'n_tokens_neox': 1010, 'n_words': 212}