コード例 #1
0
ファイル: build_install.go プロジェクト: sqrt2v/go-coreutils
The install flags -- shared with overwrite and remove -- are as follows:
	
	-a, --all           install all utilities
	-d, --dir           install utilities in specific dir (default %s ($GOBIN))
	-o, --overwrite     overwrite current GNU coreutils (if they exist)
	-p, --prefix=S      prefix command with S, e.g., if -p=go-, then
	                    the command file would be named go-wc, go-cat, etc.
		--files-from=F  install files from F (newline delimited)
		--files-from0=F install files from F (null-delimited)

`,
}

var (
	all       = flag.BoolP("all", "a", false, "")
	overwrite = flag.BoolP("overwrite", "o", false, "")
	prefix    = flag.StringP("prefix", "p", "", "")
	dir       = flag.StringP("dir", "d", "", "")

	complicated = *overwrite || *prefix != "" || *dir != ""
)

func installUtils(names []string) {
	if gobin == "" && *dir == "" {
		fmt.Println("go-coreutils: Cannot have empty $GOBIN and empty --dir")
		os.Exit(1)
	}

	if len(names) < 1 {
		fmt.Println("go-coreutils: Must list utilities to install or use --all option")
コード例 #2
0
ファイル: build_install.go プロジェクト: postfix/go-coreutils
The install flags -- shared with overwrite and remove -- are as follows:
	
	-a, --all           install all utilities
	-d, --dir           install utilities in specific dir (default %s ($GOBIN))
	-o, --overwrite     overwrite current GNU coreutils (if they exist)
	-p, --prefix=S      prefix command with S, e.g., if -p=go-, then
	                    the command file would be named go-wc, go-cat, etc.
		--files-from=F  install files from F (newline delimited)
		--files-from0=F install files from F (null-delimited)

`,
}

var (
	overwrite = flag.BoolP("overwrite", "o", false, "")
	prefix    = flag.StringP("prefix", "p", "", "")
	dir       = flag.StringP("dir", "d", "", "")
)

func installUtils(names []string) {
	if gobin == "" && *dir == "" {
		fmt.Println("Cannot have empty $GOBIN and empty --dir")
		os.Exit(1)
	}

	for _, name := range names {
		if _, ok := utilities[name]; ok {
			run(name, "go", "generate")
			run(name, "go", "install")
		}