1 Star 0 Fork 0

goproxies/github.com-kardianos-govendor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// vendor tool to copy external source code from GOPATH or remote location to the
// local vendor folder. See README.md for usage.
package main
import (
"bytes"
"flag"
"fmt"
"io"
"os"
"strings"
"github.com/kardianos/govendor/cliprompt"
"github.com/kardianos/govendor/help"
"github.com/kardianos/govendor/run"
)
func main() {
prompt := &cliprompt.Prompt{}
allArgs := os.Args
if allArgs[len(allArgs)-1] == "-" {
stdin := &bytes.Buffer{}
if _, err := io.Copy(stdin, os.Stdin); err == nil {
stdinArgs := strings.Fields(stdin.String())
allArgs = append(allArgs[:len(allArgs)-1], stdinArgs...)
}
}
msg, err := run.Run(os.Stdout, allArgs, prompt)
if err == flag.ErrHelp {
err = nil
}
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %+v\n", err)
}
msgText := msg.String()
if len(msgText) > 0 {
fmt.Fprint(os.Stderr, msgText)
}
if err != nil {
os.Exit(2)
}
switch msg {
case help.MsgNone, help.MsgGovendorVersion, help.MsgGovendorLicense:
os.Exit(0)
default:
os.Exit(1)
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/goproxies/github.com-kardianos-govendor.git
git@gitee.com:goproxies/github.com-kardianos-govendor.git
goproxies
github.com-kardianos-govendor
github.com-kardianos-govendor
v1.0.9

搜索帮助