aboutsummaryrefslogtreecommitdiff
path: root/gocryptfs-xray
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-04-09 21:23:17 +0200
committerJakob Unterwurzacher2019-05-01 13:12:44 +0200
commitdcd1068517d82d327cc3db108d1e714dad38ecc2 (patch)
tree4b2820d01fdd8456b4eecec31691f0e7e6b8662a /gocryptfs-xray
parentcc0a603ef8a691b01fbd0f6a99e7d4e1d36608f7 (diff)
gocryptfs-xray: show full usage text on flag parse error
Diffstat (limited to 'gocryptfs-xray')
-rw-r--r--gocryptfs-xray/xray_main.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/gocryptfs-xray/xray_main.go b/gocryptfs-xray/xray_main.go
index df92f2d..34f695b 100644
--- a/gocryptfs-xray/xray_main.go
+++ b/gocryptfs-xray/xray_main.go
@@ -38,19 +38,24 @@ func prettyPrintHeader(h *contentenc.FileHeader, aessiv bool) {
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() {
dumpmasterkey := flag.Bool("dumpmasterkey", false, "Decrypt and dump the master key")
aessiv := flag.Bool("aessiv", false, "Assume AES-SIV mode instead of AES-GCM")
+ flag.Usage = usage
flag.Parse()
if flag.NArg() != 1 {
- 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")
+ usage()
os.Exit(1)
}
fn := flag.Arg(0)