1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-06 02:23:24 +00:00

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-11 16:55:04 +01:00
parent 19429083ad
commit 1b2ffbeca0
24 changed files with 140 additions and 105 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/rclone/rclone/cmd"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config/flags"
"github.com/rclone/rclone/fs/operations"
"github.com/spf13/cobra"
)
@@ -16,7 +17,8 @@ var jsonOutput bool
func init() {
cmd.Root.AddCommand(commandDefinition)
commandDefinition.Flags().BoolVar(&jsonOutput, "json", false, "format output as JSON")
cmdFlags := commandDefinition.Flags()
flags.BoolVarP(cmdFlags, &jsonOutput, "json", "", false, "format output as JSON")
}
var commandDefinition = &cobra.Command{