cmd: fix environment variables not setting command line flags

Before this fix quite a lot of the commands were ignoring environment
variables intended to set flags.
This commit is contained in:
Nick Craig-Wood
2019-10-14 17:02:09 +01:00
parent 19429083ad
commit 1b2ffbeca0
24 changed files with 140 additions and 105 deletions
+4 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"github.com/rclone/rclone/cmd"
"github.com/rclone/rclone/fs/config/flags"
"github.com/rclone/rclone/fs/operations"
"github.com/rclone/rclone/fs/sync"
"github.com/spf13/cobra"
@@ -17,8 +18,9 @@ var (
func init() {
cmd.Root.AddCommand(commandDefinition)
commandDefinition.Flags().BoolVarP(&deleteEmptySrcDirs, "delete-empty-src-dirs", "", deleteEmptySrcDirs, "Delete empty source dirs after move")
commandDefinition.Flags().BoolVarP(&createEmptySrcDirs, "create-empty-src-dirs", "", createEmptySrcDirs, "Create empty source dirs on destination after move")
cmdFlags := commandDefinition.Flags()
flags.BoolVarP(cmdFlags, &deleteEmptySrcDirs, "delete-empty-src-dirs", "", deleteEmptySrcDirs, "Delete empty source dirs after move")
flags.BoolVarP(cmdFlags, &createEmptySrcDirs, "create-empty-src-dirs", "", createEmptySrcDirs, "Create empty source dirs on destination after move")
}
var commandDefinition = &cobra.Command{