diff --git a/main.go b/main.go index 2053f1a..1426dbd 100644 --- a/main.go +++ b/main.go @@ -34,6 +34,7 @@ var ( o, b, a, g, p string ung, unp string fo, do, ih bool + askconfirm bool workdir, ogdir cli.Path recursive bool termwidth int @@ -242,6 +243,14 @@ var ( Aliases: []string{"l"}, Destination: &loglvl, }, + &cli.BoolFlag{ + Name: "confirm", + Usage: "ask for confirmation before executing any action", + Value: false, + Aliases: []string{"c"}, + DisableDefaultText: true, + Destination: &askconfirm, + }, } filter_flags = []cli.Flag{ @@ -452,6 +461,9 @@ func confirm_trash(fs files.Files) error { } func confirm(prompt string) bool { + if !askconfirm { + return true + } // TODO: handle errors better // switch stdin into 'raw' mode oldState, err := term.MakeRaw(int(os.Stdin.Fd()))