Add git revision to --version output

This commit is contained in:
Junegunn Choi
2017-06-02 17:57:28 +09:00
parent 8bbf9335e1
commit 83e9af6601
4 changed files with 25 additions and 15 deletions

View File

@@ -43,12 +43,16 @@ Matcher -> EvtHeader -> Terminal (update header)
*/
// Run starts fzf
func Run(opts *Options) {
func Run(opts *Options, revision string) {
sort := opts.Sort > 0
sortCriteria = opts.Criteria
if opts.Version {
fmt.Println(version)
if len(revision) > 0 {
fmt.Printf("%s (%s)\n", version, revision)
} else {
fmt.Println(version)
}
os.Exit(exitOk)
}