From 1e598e96fcd2ef53ab2ee1e2b408e4ebe920e59b Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 30 May 2017 19:01:32 +0200 Subject: main: add "-info" option Pretty-prints the config while stripping out sensitive (and uninteresting) data https://github.com/rfjakob/gocryptfs/issues/111 --- main.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'main.go') 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 { -- cgit v1.2.3