add usage flags
This commit is contained in:
parent
2a22ce4cc5
commit
3b1079985a
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
@ -21,7 +22,29 @@ type X25519Identity struct {
|
|||||||
secretKey, ourPublicKey []byte
|
secretKey, ourPublicKey []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const usage = `Usage:
|
||||||
|
age-gen-passphrase [-o OUTPUT] [--raw-input]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-o, --output OUTPUT Write the result to the file at path OUTPUT.
|
||||||
|
--raw-output Print stripped keys (without additional text or comments)
|
||||||
|
|
||||||
|
Everything is similar to age-keygen`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
log.SetFlags(0)
|
||||||
|
flag.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", usage) }
|
||||||
|
|
||||||
|
var (
|
||||||
|
rawOutput bool
|
||||||
|
outputFile string
|
||||||
|
)
|
||||||
|
|
||||||
|
flag.BoolVar(&rawOutput, "raw-output", false, "Print stripped keys (without additional text or comments)")
|
||||||
|
flag.StringVar(&outputFile, "o", "", "Write the result to the file at path OUTPUT")
|
||||||
|
flag.StringVar(&outputFile, "output", "", "Write the result to the file at path OUTPUT")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
passbytes, err := getPasswordBytes()
|
passbytes, err := getPasswordBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errorf("Failed to get password, error: %s\n", err)
|
errorf("Failed to get password, error: %s\n", err)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user