feat: simplify future changes

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: 1fef9a9903b88ce216c4863a2c13d18030883f01 [formerly ab968c3e733db147d0e185934f03e7f965e03fde] [formerly a8e8e77ed08ca600abc156ba1cd57aff1af9d5c5 [formerly 12eb050cc2]]
Former-commit-id: eeb1864fb4c2c0d981c657a54c2d1e2a83a260e7 [formerly 09d661a1172e93b8e6a627dff2870b1e1c5903c6]
Former-commit-id: 5974a6e8e1309855e58160e6fa827de6dc5b9605
pull/726/head
Henrique Dias 2019-01-06 12:41:52 +00:00
parent 36bd2907f8
commit 94619341f2
1 changed files with 13 additions and 13 deletions

View File

@ -94,35 +94,35 @@ func getUserDefaults(cmd *cobra.Command, defaults *settings.UserDefaults, all bo
visit := func(flag *pflag.Flag) {
switch flag.Name {
case "scope":
defaults.Scope = mustGetString(cmd, "scope")
defaults.Scope = mustGetString(cmd, flag.Name)
case "locale":
defaults.Locale = mustGetString(cmd, "locale")
defaults.Locale = mustGetString(cmd, flag.Name)
case "viewMode":
defaults.ViewMode = getViewMode(cmd)
case "perm.admin":
defaults.Perm.Admin = mustGetBool(cmd, "perm.admin")
defaults.Perm.Admin = mustGetBool(cmd, flag.Name)
case "perm.execute":
defaults.Perm.Execute = mustGetBool(cmd, "perm.execute")
defaults.Perm.Execute = mustGetBool(cmd, flag.Name)
case "perm.create":
defaults.Perm.Create = mustGetBool(cmd, "perm.create")
defaults.Perm.Create = mustGetBool(cmd, flag.Name)
case "perm.rename":
defaults.Perm.Rename = mustGetBool(cmd, "perm.rename")
defaults.Perm.Rename = mustGetBool(cmd, flag.Name)
case "perm.modify":
defaults.Perm.Modify = mustGetBool(cmd, "perm.modify")
defaults.Perm.Modify = mustGetBool(cmd, flag.Name)
case "perm.delete":
defaults.Perm.Delete = mustGetBool(cmd, "perm.delete")
defaults.Perm.Delete = mustGetBool(cmd, flag.Name)
case "perm.share":
defaults.Perm.Share = mustGetBool(cmd, "perm.share")
defaults.Perm.Share = mustGetBool(cmd, flag.Name)
case "perm.download":
defaults.Perm.Download = mustGetBool(cmd, "perm.download")
defaults.Perm.Download = mustGetBool(cmd, flag.Name)
case "commands":
commands, err := cmd.Flags().GetStringSlice("commands")
commands, err := cmd.Flags().GetStringSlice(flag.Name)
checkErr(err)
defaults.Commands = commands
case "sorting.by":
defaults.Sorting.By = mustGetString(cmd, "sorting.by")
defaults.Sorting.By = mustGetString(cmd, flag.Name)
case "sorting.asc":
defaults.Sorting.Asc = mustGetBool(cmd, "sorting.asc")
defaults.Sorting.Asc = mustGetBool(cmd, flag.Name)
}
}