summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-05-30 19:01:32 +0200
committerJakob Unterwurzacher2017-05-30 19:01:32 +0200
commit1e598e96fcd2ef53ab2ee1e2b408e4ebe920e59b (patch)
tree6dd5bcae81e54b4935ecda0817518eca0ee45ebc /main.go
parentca5f469ea334bc5e93e25dae11140887d77b9673 (diff)
main: add "-info" option
Pretty-prints the config while stripping out sensitive (and uninteresting) data https://github.com/rfjakob/gocryptfs/issues/111
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/main.go b/main.go
index bc2ca12..8dada52 100644
--- a/main.go
+++ b/main.go
@@ -214,7 +214,19 @@ func main() {
} else {
tlog.Debug.Printf("OpenSSL enabled")
}
- // Operation flags: -init or -passwd; otherwise: mount
+ // Operation flags
+ if args.info && args.init || args.info && args.passwd || args.passwd && args.init {
+ tlog.Fatal.Printf("At most one of -info, -init, -passwd is allowed")
+ os.Exit(exitcodes.Usage)
+ }
+ // "-info"
+ if args.info {
+ if flagSet.NArg() > 1 {
+ tlog.Fatal.Printf("Usage: %s -info CIPHERDIR", tlog.ProgramName)
+ os.Exit(exitcodes.Usage)
+ }
+ info(args.config) // does not return
+ }
// "-init"
if args.init {
if flagSet.NArg() > 1 {