mirror of
https://github.com/wader/fq.git
synced 2024-11-22 07:16:49 +03:00
cli: Add go version to version string
This commit is contained in:
parent
5766566663
commit
550bcc27ff
@ -120,6 +120,7 @@ func (cr *CaseRun) Platform() interp.Platform {
|
|||||||
return interp.Platform{
|
return interp.Platform{
|
||||||
OS: "testos",
|
OS: "testos",
|
||||||
Arch: "testarch",
|
Arch: "testarch",
|
||||||
|
GoVersion: "testgo_version",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ func (stdOS) Platform() interp.Platform {
|
|||||||
return interp.Platform{
|
return interp.Platform{
|
||||||
OS: runtime.GOOS,
|
OS: runtime.GOOS,
|
||||||
Arch: runtime.GOARCH,
|
Arch: runtime.GOARCH,
|
||||||
|
GoVersion: runtime.Version(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ def _main:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
( . as {$version, $os, $arch, $args, args: [$arg0]}
|
( . as {$version, $os, $arch, $go_version, $args, args: [$arg0]}
|
||||||
# make sure we don't unintentionally use . to make things clearer
|
# make sure we don't unintentionally use . to make things clearer
|
||||||
| null
|
| null
|
||||||
| ( try _args_parse($args[1:]; _opt_cli_opts)
|
| ( try _args_parse($args[1:]; _opt_cli_opts)
|
||||||
@ -203,7 +203,7 @@ def _main:
|
|||||||
| println
|
| println
|
||||||
)
|
)
|
||||||
elif $opts.show_version then
|
elif $opts.show_version then
|
||||||
"\($version) (\($os) \($arch))" | println
|
"\($version) (\($os) \($arch) \($go_version))" | println
|
||||||
elif
|
elif
|
||||||
( $opts.filenames == [null] and
|
( $opts.filenames == [null] and
|
||||||
$opts.null_input == false and
|
$opts.null_input == false and
|
||||||
|
@ -133,6 +133,7 @@ type Output interface {
|
|||||||
type Platform struct {
|
type Platform struct {
|
||||||
OS string
|
OS string
|
||||||
Arch string
|
Arch string
|
||||||
|
GoVersion string
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompleteFn func(line string, pos int) (newLine []string, shared int)
|
type CompleteFn func(line string, pos int) (newLine []string, shared int)
|
||||||
@ -384,6 +385,7 @@ func (i *Interp) Main(ctx context.Context, output Output, versionStr string) err
|
|||||||
"version": versionStr,
|
"version": versionStr,
|
||||||
"os": platform.OS,
|
"os": platform.OS,
|
||||||
"arch": platform.Arch,
|
"arch": platform.Arch,
|
||||||
|
"go_version": platform.GoVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
iter, err := i.EvalFunc(ctx, input, "_main", nil, EvalOpts{output: output})
|
iter, err := i.EvalFunc(ctx, input, "_main", nil, EvalOpts{output: output})
|
||||||
|
2
pkg/interp/testdata/version.fqtest
vendored
2
pkg/interp/testdata/version.fqtest
vendored
@ -1,2 +1,2 @@
|
|||||||
$ fq -v
|
$ fq -v
|
||||||
testversion (testos testarch)
|
testversion (testos testarch testgo_version)
|
||||||
|
Loading…
Reference in New Issue
Block a user