summaryrefslogtreecommitdiff
path: root/cli_args.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-04-01 14:25:10 +0200
committerJakob Unterwurzacher2018-04-01 14:25:10 +0200
commit8fcd39a3b08f956edc0939c87b089b4dbb60afd6 (patch)
tree5c248ef6d83c19e6b70c53e34c049ac7182a6807 /cli_args.go
parent85056def909c994b66c40763f6d6c2d41c7a61d0 (diff)
main: add "-fsck" flag
The fsck operation is not yet implemented, this commits just adds the flag and improves cli flag handling.
Diffstat (limited to 'cli_args.go')
-rw-r--r--cli_args.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/cli_args.go b/cli_args.go
index 7bde89d..2f0c936 100644
--- a/cli_args.go
+++ b/cli_args.go
@@ -22,7 +22,7 @@ type argContainer struct {
plaintextnames, quiet, nosyslog, wpanic,
longnames, allow_other, ro, reverse, aessiv, nonempty, raw64,
noprealloc, speed, hkdf, serialize_reads, forcedecode, hh, info,
- sharedstorage, devrandom bool
+ sharedstorage, devrandom, fsck bool
masterkey, mountpoint, cipherdir, cpuprofile, extpass,
memprofile, ko, passfile, ctlsock, fsname, force_owner, trace string
// Configuration file name override
@@ -133,6 +133,7 @@ func parseCliOpts() (args argContainer) {
flagSet.BoolVar(&args.info, "info", false, "Display information about CIPHERDIR")
flagSet.BoolVar(&args.sharedstorage, "sharedstorage", false, "Make concurrent access to a shared CIPHERDIR safer")
flagSet.BoolVar(&args.devrandom, "devrandom", false, "Use /dev/random for generating master key")
+ flagSet.BoolVar(&args.fsck, "fsck", false, "Run a filesystem check on CIPHERDIR")
flagSet.StringVar(&args.masterkey, "masterkey", "", "Mount with explicit master key")
flagSet.StringVar(&args.cpuprofile, "cpuprofile", "", "Write cpu profile to specified file")
flagSet.StringVar(&args.memprofile, "memprofile", "", "Write memory profile to specified file")
@@ -220,3 +221,21 @@ func prettyArgs() string {
pa = pa[1 : len(pa)-1]
return pa
}
+
+// countOpFlags counts the number of operation flags we were passed.
+func countOpFlags(args *argContainer) int {
+ var count int
+ if args.info {
+ count++
+ }
+ if args.passwd {
+ count++
+ }
+ if args.init {
+ count++
+ }
+ if args.fsck {
+ count++
+ }
+ return count
+}