From 878f64a5d717a8501810bafae00fd41891f23fa7 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 7 Oct 2015 21:59:54 +0200 Subject: [PATCH] Better usage text --- gocryptfs_main/main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/gocryptfs_main/main.go b/gocryptfs_main/main.go index 35c5723..dc5c921 100644 --- a/gocryptfs_main/main.go +++ b/gocryptfs_main/main.go @@ -56,6 +56,12 @@ func initDir(dirArg string) { os.Exit(0) } +func usageText() { + fmt.Printf("Usage: %s [OPTIONS] CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME) + fmt.Printf("\nOptions:\n") + flag.PrintDefaults() +} + func main() { runtime.GOMAXPROCS(4) @@ -63,6 +69,7 @@ func main() { var debug, init, zerokey, fusedebug, openssl, passwd bool var masterkey string + flag.Usage = usageText flag.BoolVar(&debug, "debug", false, "Enable debug output") flag.BoolVar(&fusedebug, "fusedebug", false, "Enable fuse library debug output") flag.BoolVar(&init, "init", false, "Initialize encrypted directory") @@ -92,17 +99,17 @@ func main() { } if init { if flag.NArg() != 1 { - fmt.Printf("usage: %s --init CIPHERDIR\n", PROGRAM_NAME) + fmt.Printf("Usage: %s --init CIPHERDIR\n", PROGRAM_NAME) os.Exit(ERREXIT_USAGE) } initDir(flag.Arg(0)) } else if passwd { if flag.NArg() != 1 { - fmt.Printf("usage: %s --passwd CIPHERDIR\n", PROGRAM_NAME) + fmt.Printf("Usage: %s --passwd CIPHERDIR\n", PROGRAM_NAME) os.Exit(ERREXIT_USAGE) } } else if flag.NArg() < 2 { - fmt.Printf("usage: %s [OPTIONS] CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME) + usageText() os.Exit(ERREXIT_USAGE) } cipherdir, _ := filepath.Abs(flag.Arg(0))