File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ internal/cmd/extract/extract:
16
16
generate : gen_all_syscall
17
17
go generate
18
18
19
+ install :
20
+ GOFLAGS=-ldflags=-X=main.version=$$(git describe --tags ) go install ./...
21
+
19
22
tests :
20
23
go test -v ./...
21
24
go test -race ./interp
24
27
install.sh : .goreleaser.yml
25
28
godownloader --repo=traefik/yaegi -o install.sh .goreleaser.yml
26
29
27
- .PHONY : check gen_all_syscall gen_tests generate_downloader internal/cmd/extract/extract
30
+ .PHONY : check gen_all_syscall gen_tests generate_downloader internal/cmd/extract/extract install
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ The commands are:
14
14
help print usage information
15
15
run execute a Go program from source
16
16
test execute test functions in a Go package
17
+ version print version
17
18
18
19
Use "yaegi help <command>" for more information about a command.
19
20
@@ -37,6 +38,9 @@ func help(arg []string) error {
37
38
return run ([]string {"-h" })
38
39
case Test :
39
40
return test ([]string {"-h" })
41
+ case Version :
42
+ fmt .Println ("Usage: yaegi version" )
43
+ return nil
40
44
default :
41
45
return fmt .Errorf ("help: invalid yaegi command: %v" , cmd )
42
46
}
Original file line number Diff line number Diff line change @@ -106,8 +106,11 @@ const (
106
106
Help = "help"
107
107
Run = "run"
108
108
Test = "test"
109
+ Version = "version"
109
110
)
110
111
112
+ var version = "devel" // This may be overwritten at build time.
113
+
111
114
func main () {
112
115
var cmd string
113
116
var err error
@@ -128,6 +131,8 @@ func main() {
128
131
err = run (os .Args [2 :])
129
132
case Test :
130
133
err = test (os .Args [2 :])
134
+ case Version :
135
+ fmt .Println (version )
131
136
default :
132
137
// If no command is given, fallback to default "run" command.
133
138
// This allows scripts starting with "#!/usr/bin/env yaegi",
You can’t perform that action at this time.
0 commit comments