2013-05-29 22:58:46 +04:00
|
|
|
package commands
|
2013-04-09 08:53:13 +04:00
|
|
|
|
2013-05-24 10:16:00 +04:00
|
|
|
import (
|
|
|
|
"fmt"
|
2013-05-29 22:58:46 +04:00
|
|
|
"github.com/jingweno/gh/git"
|
|
|
|
"github.com/jingweno/gh/utils"
|
2013-06-29 01:21:48 +04:00
|
|
|
"os"
|
2013-05-24 10:16:00 +04:00
|
|
|
)
|
|
|
|
|
2013-12-20 02:44:58 +04:00
|
|
|
const Version = "0.27.0"
|
2013-05-24 10:16:00 +04:00
|
|
|
|
|
|
|
var cmdVersion = &Command{
|
|
|
|
Run: runVersion,
|
|
|
|
Usage: "version",
|
2013-05-24 18:25:50 +04:00
|
|
|
Short: "Show gh version",
|
2013-05-29 22:58:46 +04:00
|
|
|
Long: `Shows git version and gh client version.`,
|
2013-05-24 10:16:00 +04:00
|
|
|
}
|
|
|
|
|
2013-06-26 19:48:34 +04:00
|
|
|
func runVersion(cmd *Command, args *Args) {
|
2013-05-28 21:52:27 +04:00
|
|
|
gitVersion, err := git.Version()
|
2013-05-29 22:58:46 +04:00
|
|
|
utils.Check(err)
|
2013-05-28 21:52:27 +04:00
|
|
|
|
|
|
|
ghVersion := fmt.Sprintf("gh version %s", Version)
|
|
|
|
|
|
|
|
fmt.Println(gitVersion)
|
|
|
|
fmt.Println(ghVersion)
|
2013-06-29 01:21:48 +04:00
|
|
|
|
|
|
|
os.Exit(0)
|
2013-05-24 10:16:00 +04:00
|
|
|
}
|