Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
83e9af66
Unverified
Commit
83e9af66
authored
7 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Add git revision to --version output
parent
8bbf9335
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+15
-11
15 additions, 11 deletions
Makefile
install
+1
-1
1 addition, 1 deletion
install
main.go
+3
-1
3 additions, 1 deletion
main.go
src/core.go
+6
-2
6 additions, 2 deletions
src/core.go
with
25 additions
and
15 deletions
Makefile
+
15
−
11
View file @
83e9af66
...
...
@@ -9,14 +9,19 @@ $(error "$$GOOS is not defined.")
endif
endif
ROOT_DIR
:=
$(
shell
dirname
$(
realpath
$(
lastword
$(
MAKEFILE_LIST
))))
MAKEFILE
:=
$(
realpath
$(
lastword
$(
MAKEFILE_LIST
)))
ROOT_DIR
:=
$(
shell
dirname
$(
MAKEFILE
))
GOPATH
:=
$(
ROOT_DIR
)
/gopath
SRC_LINK
:=
$(
GOPATH
)
/src/github.com/junegunn/fzf/src
VENDOR_LINK
:=
$(
GOPATH
)
/src/github.com/junegunn/fzf/vendor
export
GOPATH
GLIDE_YAML
:=
glide.yaml
GLIDE_LOCK
:=
glide.lock
SOURCES
:=
$(
wildcard
*
.go src/
*
.go src/
*
/
*
.go
)
$(
SRC_LINK
)
$(
VENDOR_LINK
)
$(
GLIDE_LOCK
)
SOURCES
:=
$(
wildcard
*
.go src/
*
.go src/
*
/
*
.go
)
$(
SRC_LINK
)
$(
VENDOR_LINK
)
$(
GLIDE_LOCK
)
$(
MAKEFILE
)
REVISION
:=
$(
shell git log
-n
1
--pretty
=
format:%h
--
$(
SOURCES
))
BUILD_FLAGS
:=
-a
-ldflags
"-X main.revision=
$(
REVISION
)
-w -extldflags=
$(
LDFLAGS
)
"
-tags
"
$(
TAGS
)
"
BINARY32
:=
fzf-
$(
GOOS
)
_386
BINARY64
:=
fzf-
$(
GOOS
)
_amd64
...
...
@@ -31,7 +36,6 @@ RELEASEARM5 := fzf-$(VERSION)-$(GOOS)_arm5
RELEASEARM6
:=
fzf-
$(
VERSION
)
-
$(
GOOS
)
_arm6
RELEASEARM7
:=
fzf-
$(
VERSION
)
-
$(
GOOS
)
_arm7
RELEASEARM8
:=
fzf-
$(
VERSION
)
-
$(
GOOS
)
_arm8
export
GOPATH
# https://en.wikipedia.org/wiki/Uname
UNAME_M
:=
$(
shell
uname
-m
)
...
...
@@ -60,8 +64,8 @@ target:
ifeq
($(GOOS),windows)
release
:
target/$(BINARY32) target/$(BINARY64)
cd
target
&&
cp
-f
$(
BINARY32
)
fzf.exe
&&
zip
$(
RELEASE32
)
.zip
bin/
fzf.exe
cd
target
&&
cp
-f
$(
BINARY64
)
fzf.exe
&&
zip
$(
RELEASE64
)
.zip
bin/
fzf.exe
cd
target
&&
cp
-f
$(
BINARY32
)
fzf.exe
&&
zip
$(
RELEASE32
)
.zip fzf.exe
cd
target
&&
cp
-f
$(
BINARY64
)
fzf.exe
&&
zip
$(
RELEASE64
)
.zip fzf.exe
cd
target
&&
rm
-f
fzf.exe
else
ifeq
($(GOOS),linux)
release
:
target/$(BINARY32) target/$(BINARY64) target/$(BINARYARM5) target/$(BINARYARM6) target/$(BINARYARM7) target/$(BINARYARM8)
...
...
@@ -110,23 +114,23 @@ clean:
rm
-rf
target
target/$(BINARY32)
:
$(SOURCES)
GOARCH
=
386 go build
-a
-ldflags
"-w -extldflags=
$(
LDFLAGS
)
"
-tags
"
$(
TAGS
)
"
-o
$@
GOARCH
=
386 go build
$(
BUI
LD
_
FLAGS
)
-o
$@
target/$(BINARY64)
:
$(SOURCES)
GOARCH
=
amd64 go build
-a
-ldflags
"-w -extldflags=
$(
LDFLAGS
)
"
-tags
"
$(
TAGS
)
"
-o
$@
GOARCH
=
amd64 go build
$(
BUI
LD
_
FLAGS
)
-o
$@
# https://github.com/golang/go/wiki/GoArm
target/$(BINARYARM5)
:
$(SOURCES)
GOARCH
=
arm
GOARM
=
5 go build
-a
-ldflags
"-w -extldflags=
$(
LDFLAGS
)
"
-tags
"
$(
TAGS
)
"
-o
$@
GOARCH
=
arm
GOARM
=
5 go build
$(
BUI
LD
_
FLAGS
)
-o
$@
target/$(BINARYARM6)
:
$(SOURCES)
GOARCH
=
arm
GOARM
=
6 go build
-a
-ldflags
"-w -extldflags=
$(
LDFLAGS
)
"
-tags
"
$(
TAGS
)
"
-o
$@
GOARCH
=
arm
GOARM
=
6 go build
$(
BUI
LD
_
FLAGS
)
-o
$@
target/$(BINARYARM7)
:
$(SOURCES)
GOARCH
=
arm
GOARM
=
7 go build
-a
-ldflags
"-w -extldflags=
$(
LDFLAGS
)
"
-tags
"
$(
TAGS
)
"
-o
$@
GOARCH
=
arm
GOARM
=
7 go build
$(
BUI
LD
_
FLAGS
)
-o
$@
target/$(BINARYARM8)
:
$(SOURCES)
GOARCH
=
arm64 go build
-a
-ldflags
"-w -extldflags=
$(
LDFLAGS
)
"
-tags
"
$(
TAGS
)
"
-o
$@
GOARCH
=
arm64 go build
$(
BUI
LD
_
FLAGS
)
-o
$@
bin/fzf
:
target/$(BINARY) | bin
cp
-f
target/
$(
BINARY
)
bin/fzf
...
...
This diff is collapsed.
Click to expand it.
install
+
1
−
1
View file @
83e9af66
...
...
@@ -72,7 +72,7 @@ ask() {
check_binary
()
{
echo
-n
" - Checking fzf executable ... "
local
output
output
=
$(
"
$fzf_base
"
/bin/fzf
--version
2>&1
)
output
=
$(
"
$fzf_base
"
/bin/fzf
--version
2>&1
|
awk
'{print $1}'
)
if
[
$?
-ne
0
]
;
then
echo
"Error:
$output
"
binary_error
=
"Invalid binary"
...
...
This diff is collapsed.
Click to expand it.
main.go
+
3
−
1
View file @
83e9af66
...
...
@@ -2,6 +2,8 @@ package main
import
"github.com/junegunn/fzf/src"
var
revision
string
func
main
()
{
fzf
.
Run
(
fzf
.
ParseOptions
())
fzf
.
Run
(
fzf
.
ParseOptions
()
,
revision
)
}
This diff is collapsed.
Click to expand it.
src/core.go
+
6
−
2
View file @
83e9af66
...
...
@@ -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
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment