From bd054e70ef1c0f9709b5bc216ba148cf088d7edb Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 15 Aug 2018 23:31:37 +0200 Subject: trezor: show support in version string Show enable_trezor in the version string if we were compiled with `-tags enable_trezor`. And hide the `-trezor` flag from the help output if we were not. --- main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index f423cd1..26d09f5 100644 --- a/main.go +++ b/main.go @@ -129,16 +129,23 @@ func changePassword(args *argContainer) { // printVersion prints a version string like this: // gocryptfs v0.12-36-ge021b9d-dirty; go-fuse a4c968c; 2016-07-03 go1.6.2 func printVersion() { - buildFlags := "" + var tagsSlice []string if stupidgcm.BuiltWithoutOpenssl { - buildFlags = " without_openssl" + tagsSlice = append(tagsSlice, "without_openssl") + } + if readpassword.TrezorSupport { + tagsSlice = append(tagsSlice, "enable_trezor") + } + tags := "" + if tagsSlice != nil { + tags = " " + strings.Join(tagsSlice, " ") } built := fmt.Sprintf("%s %s", BuildDate, runtime.Version()) if raceDetector { built += " -race" } fmt.Printf("%s %s%s; go-fuse %s; %s\n", - tlog.ProgramName, GitVersion, buildFlags, GitVersionFuse, built) + tlog.ProgramName, GitVersion, tags, GitVersionFuse, built) } func main() { -- cgit v1.2.3