From 9f0f681592374a9f6bc7e9ba1d27247ec9a96acd Mon Sep 17 00:00:00 2001 From: Ross Kinsey Date: Sun, 26 Jan 2020 18:04:57 -0500 Subject: [PATCH 1/6] Version string added to cmd files, homebrew formula updated --- HomebrewFormula/age.rb | 3 ++- README.md | 8 +++++++- build.ps1 | 21 +++++++++++++++++++++ build.sh | 21 +++++++++++++++++++++ cmd/age-keygen/keygen.go | 15 ++++++++++++++- cmd/age/age.go | 15 ++++++++++++++- 6 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 build.ps1 create mode 100644 build.sh diff --git a/HomebrewFormula/age.rb b/HomebrewFormula/age.rb index 74a31e1c..5aca57eb 100644 --- a/HomebrewFormula/age.rb +++ b/HomebrewFormula/age.rb @@ -13,8 +13,9 @@ class Age < Formula depends_on "go" => :build def install + mkdir bin - system "go", "build", "-trimpath", "-o", bin, "filippo.io/age/cmd/..." + system "go", "build", "-trimpath", "-o", bin, "-ldflags", "\"-X main.version=#{version}\"", "filippo.io/age/cmd/..." prefix.install_metafiles end end diff --git a/README.md b/README.md index 0f15b3e6..5cc10463 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Options: -r, --recipient RECIPIENT Encrypt to the specified RECIPIENT. Can be repeated. -d, --decrypt Decrypt the input to the output. -i, --identity KEY Use the private key file at path KEY. Can be repeated. + -v, --version Print the version string and exit INPUT defaults to standard input, and OUTPUT defaults to standard output. @@ -89,8 +90,13 @@ If your system has [Go 1.13+](https://golang.org/dl/), you can build from source ``` git clone https://filippo.io/age && cd age -go build -o . filippo.io/age/cmd/... +./build.sh #(Use build.ps1 on Windows) ``` +The build script is just a wrapper around `go build` that automatically inserts version information. The same result can be achieved by running: +``` +go build --ldflags "-X main.version=$VERSION -X main.commit=$HASH" -o . filippo.io/age/cmd/... +``` +Where `$VERSION` is the current git tag and `$HASH` is the current (short) git hash On Arch Linux, age is available from AUR as [`age`](https://aur.archlinux.org/packages/age/) or [`age-git`](https://aur.archlinux.org/packages/age-git/): diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 00000000..77c92bc4 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,21 @@ +param([switch]$release=$false) +if($args.count -ne 0){ + echo "no" +} +$AV=git describe --tags +$AV=$AV -split '-\d*-g' +$AGE_VER=$av[0].Substring(1,$AV[0].length-1) + +if($release.IsPresent -or $AV.length -eq 1){ + $verstring="`"-X main.version=$AGE_VER`"" + +} else { + $verstring="`"-X main.version=$AGE_VER -X main.commit=$AV[1]`"" +} +go build --ldflags $verstring -o . filippo.io/age/cmd/... +if($?){ + echo "build success" +} else { + echo "build failed" +} + diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..6e8b6fe3 --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash +function usage() { + echo "usage: ./build.sh [--release]" +} + +if [[ $# -eq 1 ]] && [[ $1 == "--release" ]]; then + AGE_VER=$(git describe --tags) + AGE_VER=${AGE_VER:1} + go build --ldflags "-X main.version=$(git describe --tags)" -o . filippo.io/age/cmd/... + exit +elif [[ $# -ne 0 ]]; then + usage + exit +elif [[ -z $AGE_VER ]]; then + AV=$(git describe --tags) + AGE_VER=${AV%-*-*} + AGE_COMMIT=${AV##*-g} + echo AGE_VER + echo AGE_COMMIT +fi +go build --ldflags "-X main.version=$AGE_VER -X main.commit=$AGE_COMMIT" -o . filippo.io/age/cmd/... diff --git a/cmd/age-keygen/keygen.go b/cmd/age-keygen/keygen.go index 80f2d697..536c8598 100644 --- a/cmd/age-keygen/keygen.go +++ b/cmd/age-keygen/keygen.go @@ -17,11 +17,24 @@ import ( "golang.org/x/crypto/ssh/terminal" ) +var version="development" +var commit="N/A" + func main() { log.SetFlags(0) - + var verFlag bool + flag.BoolVar(&verFlag, "v", false, "print version and quit") + flag.BoolVar(&verFlag, "version", false, "print version and quit") outFlag := flag.String("o", "", "output to `FILE` (default stdout)") flag.Parse() + if verFlag { + if commit!="" { + fmt.Printf("Version: %v\nHash: %v\n", version, commit) + } else { + fmt.Printf("Version: %v,\n", version) + } + os.Exit(0) + } if len(flag.Args()) != 0 { log.Fatalf("age-keygen takes no arguments") } diff --git a/cmd/age/age.go b/cmd/age/age.go index a604bb63..bcff432d 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -27,6 +27,8 @@ func (f *multiFlag) Set(value string) error { *f = append(*f, value) return nil } +var version="Not compiled with version information" +var commit string const usage = `Usage: age -r RECIPIENT [-a] [-o OUTPUT] [INPUT] @@ -39,6 +41,7 @@ Options: -r, --recipient RECIPIENT Encrypt to the specified RECIPIENT. Can be repeated. -d, --decrypt Decrypt the input to the output. -i, --identity KEY Use the private key file at path KEY. Can be repeated. + -v, --version Print the version string and exit INPUT defaults to standard input, and OUTPUT defaults to standard output. @@ -61,7 +64,7 @@ func main() { var ( outFlag string - decryptFlag, armorFlag, passFlag bool + decryptFlag, armorFlag, passFlag, verFlag bool recipientFlags, identityFlags multiFlag ) @@ -77,12 +80,22 @@ func main() { flag.Var(&recipientFlags, "recipient", "recipient (can be repeated)") flag.Var(&identityFlags, "i", "identity (can be repeated)") flag.Var(&identityFlags, "identity", "identity (can be repeated)") + flag.BoolVar(&verFlag, "v", false, "print version and quit") + flag.BoolVar(&verFlag, "version", false, "print version and quit") flag.Parse() if flag.NArg() > 1 { logFatalf("Error: too many arguments.\n" + "age accepts a single optional argument for the input file.") } + if verFlag { + if commit!="" { + fmt.Printf("Version: %v\nHash: %v\n", version, commit) + } else { + fmt.Printf("Version: %v,\n", version) + } + os.Exit(0) + } switch { case decryptFlag: if armorFlag { From eb1eb345e7c76975f85ba74466d183f24c7bbd56 Mon Sep 17 00:00:00 2001 From: Ross Kinsey Date: Mon, 27 Jan 2020 18:36:23 -0500 Subject: [PATCH 2/6] Version printing and build scripts complete, README updated Renamed scripts, too --- README.md | 2 +- build.ps1 | 21 --------------------- build.sh | 21 --------------------- build_age | 25 +++++++++++++++++++++++++ build_age.ps1 | 27 +++++++++++++++++++++++++++ cmd/age-keygen/keygen.go | 8 ++++---- cmd/age/age.go | 11 ++++++----- 7 files changed, 63 insertions(+), 52 deletions(-) delete mode 100644 build.ps1 delete mode 100644 build.sh create mode 100644 build_age create mode 100644 build_age.ps1 diff --git a/README.md b/README.md index 5cc10463..cd4702b5 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ If your system has [Go 1.13+](https://golang.org/dl/), you can build from source ``` git clone https://filippo.io/age && cd age -./build.sh #(Use build.ps1 on Windows) +./build_age #(Use build_age.ps1 with Powershell) ``` The build script is just a wrapper around `go build` that automatically inserts version information. The same result can be achieved by running: ``` diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 77c92bc4..00000000 --- a/build.ps1 +++ /dev/null @@ -1,21 +0,0 @@ -param([switch]$release=$false) -if($args.count -ne 0){ - echo "no" -} -$AV=git describe --tags -$AV=$AV -split '-\d*-g' -$AGE_VER=$av[0].Substring(1,$AV[0].length-1) - -if($release.IsPresent -or $AV.length -eq 1){ - $verstring="`"-X main.version=$AGE_VER`"" - -} else { - $verstring="`"-X main.version=$AGE_VER -X main.commit=$AV[1]`"" -} -go build --ldflags $verstring -o . filippo.io/age/cmd/... -if($?){ - echo "build success" -} else { - echo "build failed" -} - diff --git a/build.sh b/build.sh deleted file mode 100644 index 6e8b6fe3..00000000 --- a/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -function usage() { - echo "usage: ./build.sh [--release]" -} - -if [[ $# -eq 1 ]] && [[ $1 == "--release" ]]; then - AGE_VER=$(git describe --tags) - AGE_VER=${AGE_VER:1} - go build --ldflags "-X main.version=$(git describe --tags)" -o . filippo.io/age/cmd/... - exit -elif [[ $# -ne 0 ]]; then - usage - exit -elif [[ -z $AGE_VER ]]; then - AV=$(git describe --tags) - AGE_VER=${AV%-*-*} - AGE_COMMIT=${AV##*-g} - echo AGE_VER - echo AGE_COMMIT -fi -go build --ldflags "-X main.version=$AGE_VER -X main.commit=$AGE_COMMIT" -o . filippo.io/age/cmd/... diff --git a/build_age b/build_age new file mode 100644 index 00000000..bef19335 --- /dev/null +++ b/build_age @@ -0,0 +1,25 @@ +#!/bin/bash + +function usage() { + echo "usage: ./build_age [--release]" + exit 1 +} +# --release doesn't use a hash to allow for minor post-tag commits (e.g. README updates) without having to revert or retag +if [[ $# -eq 1 ]] && [[ $1 == "--release" ]]; then + AGE_VER=$(git describe --tags) +elif [[ $# -ne 0 ]]; then + usage +else + AV=$(git describe --tags) + AGE_VER=${AV%-*-g*} + AGE_COMMIT=$(git rev-parse --short HEAD) +fi + +go build --ldflags "-X main.version=${AGE_VER:1} -X main.commit=$AGE_COMMIT" -o . filippo.io/age/cmd/... +if [[ $? ]]; then + echo "age build success" +else + echo "age build failure" + exit 1 +fi + diff --git a/build_age.ps1 b/build_age.ps1 new file mode 100644 index 00000000..3a690356 --- /dev/null +++ b/build_age.ps1 @@ -0,0 +1,27 @@ +param([switch] $release = $false) + +if($args.count -ne 0){ + Write-Output "Usage: ./build_age.ps1 [-release]" + exit 1 +} + +$AV=git describe --tags +$AV=$AV -split '-\d*-g' +$AGE_VER=$av[0].Substring(1,$AV[0].length-1) + +# -release doesn't use a hash to allow for minor post-tag commits (e.g. README updates) without having to revert or retag +if($release.IsPresent -or $AV.length -eq 1){ + $verstring="`"-X main.version=$AGE_VER`"" +} else{ + $verstring="`"-X main.version=$AGE_VER -X main.commit=$($AV[1])`"" +} + +go build --ldflags $verstring -o . filippo.io/age/cmd/... + +if($?){ + Write-Output "build success" +} else{ + Write-Output "build failure" + exit 1 +} + diff --git a/cmd/age-keygen/keygen.go b/cmd/age-keygen/keygen.go index 536c8598..c3db1745 100644 --- a/cmd/age-keygen/keygen.go +++ b/cmd/age-keygen/keygen.go @@ -17,8 +17,8 @@ import ( "golang.org/x/crypto/ssh/terminal" ) -var version="development" -var commit="N/A" +var version = "not compiled with version information" +var commit string func main() { log.SetFlags(0) @@ -28,10 +28,10 @@ func main() { outFlag := flag.String("o", "", "output to `FILE` (default stdout)") flag.Parse() if verFlag { - if commit!="" { + if commit != "" { fmt.Printf("Version: %v\nHash: %v\n", version, commit) } else { - fmt.Printf("Version: %v,\n", version) + fmt.Printf("Version: %v\n", version) } os.Exit(0) } diff --git a/cmd/age/age.go b/cmd/age/age.go index bcff432d..0c614b7a 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -27,7 +27,8 @@ func (f *multiFlag) Set(value string) error { *f = append(*f, value) return nil } -var version="Not compiled with version information" + +var version = "Not compiled with version information" var commit string const usage = `Usage: @@ -63,9 +64,9 @@ func main() { flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", usage) } var ( - outFlag string + outFlag string decryptFlag, armorFlag, passFlag, verFlag bool - recipientFlags, identityFlags multiFlag + recipientFlags, identityFlags multiFlag ) flag.BoolVar(&decryptFlag, "d", false, "decrypt the input") @@ -89,10 +90,10 @@ func main() { "age accepts a single optional argument for the input file.") } if verFlag { - if commit!="" { + if commit != "" { fmt.Printf("Version: %v\nHash: %v\n", version, commit) } else { - fmt.Printf("Version: %v,\n", version) + fmt.Printf("Version: %v\n", version) } os.Exit(0) } From bdace5aab5a40096696f68ef2a73ed03df2183aa Mon Sep 17 00:00:00 2001 From: Ross Kinsey Date: Mon, 27 Jan 2020 20:10:20 -0500 Subject: [PATCH 3/6] Added usage to keygen, added help flags that print usage to age & keygen --- cmd/age-keygen/keygen.go | 34 +++++++++++++++++++++++++++++----- cmd/age/age.go | 29 ++++++++++++++++++----------- 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/cmd/age-keygen/keygen.go b/cmd/age-keygen/keygen.go index c3db1745..3df98258 100644 --- a/cmd/age-keygen/keygen.go +++ b/cmd/age-keygen/keygen.go @@ -20,23 +20,47 @@ import ( var version = "not compiled with version information" var commit string +const usage = `Usage: + age-keygen [>> /path/to/keyfile] + age-keygen -o OUTPUT + +Options: + -o OUTPUT Write the result to the file at path OUTPUT. + -v, --version Print the version string and exit + -h, --help Print this message and exit + +If -o is not provided, OUTPUT defaults to standard output + +Example: + $ age-keygen -o key.txt + Public key: age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p` + func main() { log.SetFlags(0) - var verFlag bool + flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", usage) } + + var verFlag, helpFlag bool flag.BoolVar(&verFlag, "v", false, "print version and quit") flag.BoolVar(&verFlag, "version", false, "print version and quit") + flag.BoolVar(&helpFlag, "h", false, "print usage and quit") + flag.BoolVar(&helpFlag, "help", false, "print usage and quit") outFlag := flag.String("o", "", "output to `FILE` (default stdout)") flag.Parse() - if verFlag { + switch { + case helpFlag: + fmt.Printf("%s\n", usage) + os.Exit(0) + case verFlag: if commit != "" { - fmt.Printf("Version: %v\nHash: %v\n", version, commit) + fmt.Printf("Version: %s\nHash: %s\n", version, commit) } else { - fmt.Printf("Version: %v\n", version) + fmt.Printf("Version: %s\n", version) } os.Exit(0) } if len(flag.Args()) != 0 { - log.Fatalf("age-keygen takes no arguments") + log.Fatalf("age-keygen takes no arguments.\n"+ + "Run age-keygen -h for help") } out := os.Stdout diff --git a/cmd/age/age.go b/cmd/age/age.go index 0c614b7a..5118c91d 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -28,7 +28,7 @@ func (f *multiFlag) Set(value string) error { return nil } -var version = "Not compiled with version information" +var version = "not compiled with version information" var commit string const usage = `Usage: @@ -42,7 +42,8 @@ Options: -r, --recipient RECIPIENT Encrypt to the specified RECIPIENT. Can be repeated. -d, --decrypt Decrypt the input to the output. -i, --identity KEY Use the private key file at path KEY. Can be repeated. - -v, --version Print the version string and exit + -v, --version Print the version string and exit + -h, --help Print this message and exit INPUT defaults to standard input, and OUTPUT defaults to standard output. @@ -64,9 +65,9 @@ func main() { flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", usage) } var ( - outFlag string - decryptFlag, armorFlag, passFlag, verFlag bool - recipientFlags, identityFlags multiFlag + outFlag string + decryptFlag, armorFlag, passFlag, verFlag, helpFlag bool + recipientFlags, identityFlags multiFlag ) flag.BoolVar(&decryptFlag, "d", false, "decrypt the input") @@ -83,21 +84,27 @@ func main() { flag.Var(&identityFlags, "identity", "identity (can be repeated)") flag.BoolVar(&verFlag, "v", false, "print version and quit") flag.BoolVar(&verFlag, "version", false, "print version and quit") + flag.BoolVar(&helpFlag, "h", false, "print usage and quit") + flag.BoolVar(&helpFlag, "help", false, "print usage and quit") flag.Parse() if flag.NArg() > 1 { logFatalf("Error: too many arguments.\n" + - "age accepts a single optional argument for the input file.") + "age accepts a single optional argument for the input file.\n" + + "Run age -h for help") } - if verFlag { + + switch { + case helpFlag: + fmt.Printf("%s\n", usage) + os.Exit(0) + case verFlag: if commit != "" { - fmt.Printf("Version: %v\nHash: %v\n", version, commit) + fmt.Printf("Version: %s\nHash: %s\n", version, commit) } else { - fmt.Printf("Version: %v\n", version) + fmt.Printf("Version: %s\n", version) } os.Exit(0) - } - switch { case decryptFlag: if armorFlag { logFatalf("Error: -a/--armor can't be used with -d/--decrypt.\n" + From 9e5f80eb77d49fcfe23c948ca38cc087c45842a3 Mon Sep 17 00:00:00 2001 From: Ross Kinsey Date: Mon, 27 Jan 2020 20:59:14 -0500 Subject: [PATCH 4/6] Usage logged when age run with no arguments or flags added help flag to README usage --- README.md | 1 + cmd/age/age.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cd4702b5..de95b1c5 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Options: -d, --decrypt Decrypt the input to the output. -i, --identity KEY Use the private key file at path KEY. Can be repeated. -v, --version Print the version string and exit + -h, --help Print this message and exit INPUT defaults to standard input, and OUTPUT defaults to standard output. diff --git a/cmd/age/age.go b/cmd/age/age.go index 5118c91d..b32355d2 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -88,7 +88,9 @@ func main() { flag.BoolVar(&helpFlag, "help", false, "print usage and quit") flag.Parse() - if flag.NArg() > 1 { + if flag.NArg()+flag.NFlag() == 0 { + logFatalf("%s\n", usage) + } else if flag.NArg() > 1 { logFatalf("Error: too many arguments.\n" + "age accepts a single optional argument for the input file.\n" + "Run age -h for help") From 3369ce90694b7a7be439f159385318ef3a1a28a6 Mon Sep 17 00:00:00 2001 From: Ross Kinsey Date: Mon, 27 Jan 2020 22:25:14 -0500 Subject: [PATCH 5/6] Fixed age.rb Escaped quotes were unnecessary and failed to pass properly added v back to start of version strings --- HomebrewFormula/age.rb | 2 +- build_age | 2 +- build_age.ps1 | 5 ++--- cmd/age-keygen/keygen.go | 6 ++++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/HomebrewFormula/age.rb b/HomebrewFormula/age.rb index 5aca57eb..7641e6b8 100644 --- a/HomebrewFormula/age.rb +++ b/HomebrewFormula/age.rb @@ -15,7 +15,7 @@ class Age < Formula def install mkdir bin - system "go", "build", "-trimpath", "-o", bin, "-ldflags", "\"-X main.version=#{version}\"", "filippo.io/age/cmd/..." + system "go", "build", "-trimpath", "-o", bin, "-ldflags", "-X main.version=v#{version}", "filippo.io/age/cmd/..." prefix.install_metafiles end end diff --git a/build_age b/build_age index bef19335..d617fe3e 100644 --- a/build_age +++ b/build_age @@ -15,7 +15,7 @@ else AGE_COMMIT=$(git rev-parse --short HEAD) fi -go build --ldflags "-X main.version=${AGE_VER:1} -X main.commit=$AGE_COMMIT" -o . filippo.io/age/cmd/... +go build --ldflags "-X main.version=$AGE_VER -X main.commit=$AGE_COMMIT" -o . filippo.io/age/cmd/... if [[ $? ]]; then echo "age build success" else diff --git a/build_age.ps1 b/build_age.ps1 index 3a690356..b2fd2ed4 100644 --- a/build_age.ps1 +++ b/build_age.ps1 @@ -7,10 +7,9 @@ if($args.count -ne 0){ $AV=git describe --tags $AV=$AV -split '-\d*-g' -$AGE_VER=$av[0].Substring(1,$AV[0].length-1) - +$AGE_VER=$av[0] # -release doesn't use a hash to allow for minor post-tag commits (e.g. README updates) without having to revert or retag -if($release.IsPresent -or $AV.length -eq 1){ +if($release.IsPresent){ $verstring="`"-X main.version=$AGE_VER`"" } else{ $verstring="`"-X main.version=$AGE_VER -X main.commit=$($AV[1])`"" diff --git a/cmd/age-keygen/keygen.go b/cmd/age-keygen/keygen.go index 3df98258..449f4827 100644 --- a/cmd/age-keygen/keygen.go +++ b/cmd/age-keygen/keygen.go @@ -21,7 +21,7 @@ var version = "not compiled with version information" var commit string const usage = `Usage: - age-keygen [>> /path/to/keyfile] + age-keygen age-keygen -o OUTPUT Options: @@ -33,7 +33,9 @@ If -o is not provided, OUTPUT defaults to standard output Example: $ age-keygen -o key.txt - Public key: age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p` + Public key: age12d695gkxyk07dfng0ght8thsc9yhug74um2hnydslpunjvjpvd7s3dzp6m + $ cat key.txt|grep KEY + AGE-SECRET-KEY-1L3W64GQX6H8YPG7HXW7EMTXHSJ97Q3G8HGGPXS2N5PRT9H6TDD6S7LRZZS` func main() { log.SetFlags(0) From bc16d0894944401aa53e5b04ae146be415f894f0 Mon Sep 17 00:00:00 2001 From: Ross Kinsey Date: Tue, 28 Jan 2020 08:33:34 -0500 Subject: [PATCH 6/6] Removed -v to avoid potential future issues --- README.md | 2 +- cmd/age-keygen/keygen.go | 3 +-- cmd/age/age.go | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index de95b1c5..eef01e1b 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ Options: -r, --recipient RECIPIENT Encrypt to the specified RECIPIENT. Can be repeated. -d, --decrypt Decrypt the input to the output. -i, --identity KEY Use the private key file at path KEY. Can be repeated. - -v, --version Print the version string and exit -h, --help Print this message and exit + --version Print the version string and exit INPUT defaults to standard input, and OUTPUT defaults to standard output. diff --git a/cmd/age-keygen/keygen.go b/cmd/age-keygen/keygen.go index 449f4827..2ed2c618 100644 --- a/cmd/age-keygen/keygen.go +++ b/cmd/age-keygen/keygen.go @@ -26,8 +26,8 @@ const usage = `Usage: Options: -o OUTPUT Write the result to the file at path OUTPUT. - -v, --version Print the version string and exit -h, --help Print this message and exit + --version Print the version string and exit If -o is not provided, OUTPUT defaults to standard output @@ -42,7 +42,6 @@ func main() { flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", usage) } var verFlag, helpFlag bool - flag.BoolVar(&verFlag, "v", false, "print version and quit") flag.BoolVar(&verFlag, "version", false, "print version and quit") flag.BoolVar(&helpFlag, "h", false, "print usage and quit") flag.BoolVar(&helpFlag, "help", false, "print usage and quit") diff --git a/cmd/age/age.go b/cmd/age/age.go index b32355d2..a318fbf1 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -42,8 +42,8 @@ Options: -r, --recipient RECIPIENT Encrypt to the specified RECIPIENT. Can be repeated. -d, --decrypt Decrypt the input to the output. -i, --identity KEY Use the private key file at path KEY. Can be repeated. - -v, --version Print the version string and exit -h, --help Print this message and exit + --version Print the version string and exit INPUT defaults to standard input, and OUTPUT defaults to standard output. @@ -82,7 +82,6 @@ func main() { flag.Var(&recipientFlags, "recipient", "recipient (can be repeated)") flag.Var(&identityFlags, "i", "identity (can be repeated)") flag.Var(&identityFlags, "identity", "identity (can be repeated)") - flag.BoolVar(&verFlag, "v", false, "print version and quit") flag.BoolVar(&verFlag, "version", false, "print version and quit") flag.BoolVar(&helpFlag, "h", false, "print usage and quit") flag.BoolVar(&helpFlag, "help", false, "print usage and quit")