gocryptfs-xray: show full usage text on flag parse error
This commit is contained in:
parent
cc0a603ef8
commit
dcd1068517
@ -38,19 +38,24 @@ func prettyPrintHeader(h *contentenc.FileHeader, aessiv bool) {
|
|||||||
fmt.Printf(msg+"\n", h.Version, id)
|
fmt.Printf(msg+"\n", h.Version, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func usage() {
|
||||||
|
fmt.Fprintf(os.Stderr, "Usage: %s [OPTIONS] FILE\n"+
|
||||||
|
"\n"+
|
||||||
|
"Options:\n", myName)
|
||||||
|
flag.PrintDefaults()
|
||||||
|
fmt.Fprintf(os.Stderr, "\n"+
|
||||||
|
"Examples:\n"+
|
||||||
|
" gocryptfs-xray myfs/mCXnISiv7nEmyc0glGuhTQ\n"+
|
||||||
|
" gocryptfs-xray -dumpmasterkey myfs/gocryptfs.conf\n")
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
dumpmasterkey := flag.Bool("dumpmasterkey", false, "Decrypt and dump the master key")
|
dumpmasterkey := flag.Bool("dumpmasterkey", false, "Decrypt and dump the master key")
|
||||||
aessiv := flag.Bool("aessiv", false, "Assume AES-SIV mode instead of AES-GCM")
|
aessiv := flag.Bool("aessiv", false, "Assume AES-SIV mode instead of AES-GCM")
|
||||||
|
flag.Usage = usage
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
if flag.NArg() != 1 {
|
if flag.NArg() != 1 {
|
||||||
fmt.Fprintf(os.Stderr, "Usage: %s [OPTIONS] FILE\n"+
|
usage()
|
||||||
"\n"+
|
|
||||||
"Options:\n", myName)
|
|
||||||
flag.PrintDefaults()
|
|
||||||
fmt.Fprintf(os.Stderr, "\n"+
|
|
||||||
"Examples:\n"+
|
|
||||||
" gocryptfs-xray myfs/mCXnISiv7nEmyc0glGuhTQ\n"+
|
|
||||||
" gocryptfs-xray -dumpmasterkey myfs/gocryptfs.conf\n")
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
fn := flag.Arg(0)
|
fn := flag.Arg(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user