main: show "-o" in the help text
Binds it to a dummy variable so it appears in the help text.
This commit is contained in:
parent
7b2049c769
commit
c8e5dc9844
20
cli_args.go
20
cli_args.go
@ -61,6 +61,10 @@ func prefixOArgs(osArgs []string) []string {
|
|||||||
if o == "" {
|
if o == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if o == "o" || o == "-o" {
|
||||||
|
tlog.Fatal.Printf("You can't pass \"-o\" to \"-o\"")
|
||||||
|
os.Exit(ErrExitUsage)
|
||||||
|
}
|
||||||
newArgs = append(newArgs, "-"+o)
|
newArgs = append(newArgs, "-"+o)
|
||||||
}
|
}
|
||||||
// Add other arguments
|
// Add other arguments
|
||||||
@ -111,19 +115,23 @@ func parseCliOpts() (args argContainer) {
|
|||||||
flagSet.IntVar(&args.scryptn, "scryptn", configfile.ScryptDefaultLogN, "scrypt cost parameter logN. "+
|
flagSet.IntVar(&args.scryptn, "scryptn", configfile.ScryptDefaultLogN, "scrypt cost parameter logN. "+
|
||||||
"Setting this to a lower value speeds up mounting but makes the password susceptible to brute-force attacks")
|
"Setting this to a lower value speeds up mounting but makes the password susceptible to brute-force attacks")
|
||||||
// Ignored otions
|
// Ignored otions
|
||||||
var ignoredBool bool
|
var dummyBool bool
|
||||||
ignoreText := "(ignored for compatability)"
|
ignoreText := "(ignored for compatability)"
|
||||||
flagSet.BoolVar(&ignoredBool, "rw", false, ignoreText)
|
flagSet.BoolVar(&dummyBool, "rw", false, ignoreText)
|
||||||
flagSet.BoolVar(&ignoredBool, "nosuid", false, ignoreText)
|
flagSet.BoolVar(&dummyBool, "nosuid", false, ignoreText)
|
||||||
flagSet.BoolVar(&ignoredBool, "nodev", false, ignoreText)
|
flagSet.BoolVar(&dummyBool, "nodev", false, ignoreText)
|
||||||
|
var dummyString string
|
||||||
|
flagSet.StringVar(&dummyString, "o", "", "For compatability, all options can be also passed as a comma-separated list to -o.")
|
||||||
// Actual parsing
|
// Actual parsing
|
||||||
err = flagSet.Parse(os.Args[1:])
|
err = flagSet.Parse(os.Args[1:])
|
||||||
|
if err == flag.ErrHelp {
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tlog.Warn.Printf("You passed: %s", prettyArgs())
|
tlog.Warn.Printf("You passed: %s", prettyArgs())
|
||||||
tlog.Fatal.Printf("%v", err)
|
tlog.Fatal.Printf("%v", err)
|
||||||
os.Exit(2)
|
os.Exit(ErrExitUsage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// "-openssl" needs some post-processing
|
// "-openssl" needs some post-processing
|
||||||
if opensslAuto == "auto" {
|
if opensslAuto == "auto" {
|
||||||
args.openssl = prefer_openssl.PreferOpenSSL()
|
args.openssl = prefer_openssl.PreferOpenSSL()
|
||||||
|
@ -178,6 +178,7 @@ func TestShadows(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
// This should work
|
// This should work
|
||||||
|
// (note that MountOrFatal creates "mnt" again)
|
||||||
test_helpers.MountOrFatal(t, cipher, mnt, "-extpass=echo test")
|
test_helpers.MountOrFatal(t, cipher, mnt, "-extpass=echo test")
|
||||||
test_helpers.UnmountPanic(mnt)
|
test_helpers.UnmountPanic(mnt)
|
||||||
cipher2 := mnt + "/cipher"
|
cipher2 := mnt + "/cipher"
|
||||||
|
Loading…
Reference in New Issue
Block a user