提交 2b471bd4 编写于 作者: M Mislav Marohnić

[version] Support `--build-options`

Ensure that all flags are forwarded to `git version`

Fixes #2440
上级 57b8337d
......@@ -2,7 +2,6 @@ package commands
import (
"github.com/github/hub/ui"
"github.com/github/hub/utils"
"github.com/github/hub/version"
)
......@@ -18,10 +17,8 @@ func init() {
}
func runVersion(cmd *Command, args *Args) {
output, err := version.FullVersion()
if output != "" {
ui.Println(output)
}
utils.Check(err)
versionCmd := args.ToCmd()
versionCmd.Spawn()
ui.Printf("hub version %s\n", version.Version)
args.NoForward()
}
......@@ -94,11 +94,14 @@ const crashReportTmpl = "Crash report - %v\n\n" +
"Error (%s): `%v`\n\n" +
"Stack:\n\n```\n%s\n```\n\n" +
"Runtime:\n\n```\n%s\n```\n\n" +
"Version:\n\n```\n%s\n```\n"
"Version:\n\n```\n%s\nhub version %s\n```\n"
func reportTitleAndBody(reportedError error, stack string) (title, body string, err error) {
errType := reflect.TypeOf(reportedError).String()
fullVersion, _ := version.FullVersion()
gitVersion, gitErr := git.Version()
if gitErr != nil {
gitVersion = "git unavailable!"
}
message := fmt.Sprintf(
crashReportTmpl,
reportedError,
......@@ -106,7 +109,8 @@ func reportTitleAndBody(reportedError error, stack string) (title, body string,
reportedError,
stack,
runtimeInfo(),
fullVersion,
gitVersion,
version.Version,
)
messageBuilder := &MessageBuilder{
......
package version
import (
"fmt"
"github.com/github/hub/git"
)
// Version represents the hub version number
var Version = "2.13.0"
func FullVersion() (string, error) {
gitVersion, err := git.Version()
if err != nil {
gitVersion = "git version (unavailable)"
}
return fmt.Sprintf("%s\nhub version %s", gitVersion, Version), err
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册