<commit_before>package main

import (
    "fmt"
    "os"
)

func main() {
    env := os.Environ()

    for _, envar := range env {
        fmt.Println(envar)
    }
}<commit_msg>env: help, version and zeroByte support<commit_after>package main

import (
	"code.google.com/p/opts-go"
	"fmt"
	"os"
)

const (
	version = `env (go coretutils) 0.1
Packaged by <NAME>
Copyright (c) 2014 <NAME>
License MIT: <http://opensource.org/licenses/MIT>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by <NAME>`

	usage = `Usage: env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
Set each NAME to VALUE in the environment and run COMMAND.

  -i, --ignore-environment  start with an empty environment
  -0, --null           end each output line with 0 byte rather than newline
  -u, --unset=NAME     remove variable from the environment
      --help     display this help and exit
      --version  output version information and exit

A mere - implies -i.  If no COMMAND, print the resulting environment.`
)

func main() {
	opts.Usage = usage
	showHelp := opts.Flag("", "--help", "Help")
	showVersion := opts.Flag("", "--version", "Version")
	zeroByte := opts.Flag("-0", "--null", "ZeroByte")

	opts.Parse()

	if *showHelp {
		fmt.Print(usage)
		os.Exit(0)
	}

	if *showVersion {
		fmt.Print(version)
		os.Exit(0)
	}

	env := os.Environ()[2:] // [1] -> working directory, [2] -> exit code; so skip these

	for _, envar := range env {
		if *zeroByte {
			fmt.Print(envar)
			fmt.Print("\x00")
		} else {
			fmt.Println(envar)
		}
	}
}
{'fraction_non_alphanumeric': 0.14784778540237056, 'fraction_numerical': 0.009981285090455396, 'mean_word_length': 2.9313725490196076, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '177141', 'n_tokens_mistral': 579, 'n_tokens_neox': 543, 'n_words': 179}