summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-07 21:59:54 +0200
committerJakob Unterwurzacher2015-10-07 21:59:54 +0200
commit878f64a5d717a8501810bafae00fd41891f23fa7 (patch)
treee4bea64b286bb7a5fcc8b49d57ca4c3d29976df1
parentbef73c63b35f992b0c9f32aa9b0b0da669b22a43 (diff)
Better usage text
-rw-r--r--gocryptfs_main/main.go13
1 files 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))