Better usage text
This commit is contained in:
parent
bef73c63b3
commit
878f64a5d7
@ -56,6 +56,12 @@ func initDir(dirArg string) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func usageText() {
|
||||||
|
fmt.Printf("Usage: %s [OPTIONS] CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME)
|
||||||
|
fmt.Printf("\nOptions:\n")
|
||||||
|
flag.PrintDefaults()
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
runtime.GOMAXPROCS(4)
|
runtime.GOMAXPROCS(4)
|
||||||
|
|
||||||
@ -63,6 +69,7 @@ func main() {
|
|||||||
var debug, init, zerokey, fusedebug, openssl, passwd bool
|
var debug, init, zerokey, fusedebug, openssl, passwd bool
|
||||||
var masterkey string
|
var masterkey string
|
||||||
|
|
||||||
|
flag.Usage = usageText
|
||||||
flag.BoolVar(&debug, "debug", false, "Enable debug output")
|
flag.BoolVar(&debug, "debug", false, "Enable debug output")
|
||||||
flag.BoolVar(&fusedebug, "fusedebug", false, "Enable fuse library debug output")
|
flag.BoolVar(&fusedebug, "fusedebug", false, "Enable fuse library debug output")
|
||||||
flag.BoolVar(&init, "init", false, "Initialize encrypted directory")
|
flag.BoolVar(&init, "init", false, "Initialize encrypted directory")
|
||||||
@ -92,17 +99,17 @@ func main() {
|
|||||||
}
|
}
|
||||||
if init {
|
if init {
|
||||||
if flag.NArg() != 1 {
|
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)
|
os.Exit(ERREXIT_USAGE)
|
||||||
}
|
}
|
||||||
initDir(flag.Arg(0))
|
initDir(flag.Arg(0))
|
||||||
} else if passwd {
|
} else if passwd {
|
||||||
if flag.NArg() != 1 {
|
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)
|
os.Exit(ERREXIT_USAGE)
|
||||||
}
|
}
|
||||||
} else if flag.NArg() < 2 {
|
} else if flag.NArg() < 2 {
|
||||||
fmt.Printf("usage: %s [OPTIONS] CIPHERDIR MOUNTPOINT\n", PROGRAM_NAME)
|
usageText()
|
||||||
os.Exit(ERREXIT_USAGE)
|
os.Exit(ERREXIT_USAGE)
|
||||||
}
|
}
|
||||||
cipherdir, _ := filepath.Abs(flag.Arg(0))
|
cipherdir, _ := filepath.Abs(flag.Arg(0))
|
||||||
|
Loading…
Reference in New Issue
Block a user