feat: simplify future changes
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>pull/609/head
parent
02c34ef8be
commit
12eb050cc2
26
cmd/users.go
26
cmd/users.go
|
@ -94,35 +94,35 @@ func getUserDefaults(cmd *cobra.Command, defaults *settings.UserDefaults, all bo
|
||||||
visit := func(flag *pflag.Flag) {
|
visit := func(flag *pflag.Flag) {
|
||||||
switch flag.Name {
|
switch flag.Name {
|
||||||
case "scope":
|
case "scope":
|
||||||
defaults.Scope = mustGetString(cmd, "scope")
|
defaults.Scope = mustGetString(cmd, flag.Name)
|
||||||
case "locale":
|
case "locale":
|
||||||
defaults.Locale = mustGetString(cmd, "locale")
|
defaults.Locale = mustGetString(cmd, flag.Name)
|
||||||
case "viewMode":
|
case "viewMode":
|
||||||
defaults.ViewMode = getViewMode(cmd)
|
defaults.ViewMode = getViewMode(cmd)
|
||||||
case "perm.admin":
|
case "perm.admin":
|
||||||
defaults.Perm.Admin = mustGetBool(cmd, "perm.admin")
|
defaults.Perm.Admin = mustGetBool(cmd, flag.Name)
|
||||||
case "perm.execute":
|
case "perm.execute":
|
||||||
defaults.Perm.Execute = mustGetBool(cmd, "perm.execute")
|
defaults.Perm.Execute = mustGetBool(cmd, flag.Name)
|
||||||
case "perm.create":
|
case "perm.create":
|
||||||
defaults.Perm.Create = mustGetBool(cmd, "perm.create")
|
defaults.Perm.Create = mustGetBool(cmd, flag.Name)
|
||||||
case "perm.rename":
|
case "perm.rename":
|
||||||
defaults.Perm.Rename = mustGetBool(cmd, "perm.rename")
|
defaults.Perm.Rename = mustGetBool(cmd, flag.Name)
|
||||||
case "perm.modify":
|
case "perm.modify":
|
||||||
defaults.Perm.Modify = mustGetBool(cmd, "perm.modify")
|
defaults.Perm.Modify = mustGetBool(cmd, flag.Name)
|
||||||
case "perm.delete":
|
case "perm.delete":
|
||||||
defaults.Perm.Delete = mustGetBool(cmd, "perm.delete")
|
defaults.Perm.Delete = mustGetBool(cmd, flag.Name)
|
||||||
case "perm.share":
|
case "perm.share":
|
||||||
defaults.Perm.Share = mustGetBool(cmd, "perm.share")
|
defaults.Perm.Share = mustGetBool(cmd, flag.Name)
|
||||||
case "perm.download":
|
case "perm.download":
|
||||||
defaults.Perm.Download = mustGetBool(cmd, "perm.download")
|
defaults.Perm.Download = mustGetBool(cmd, flag.Name)
|
||||||
case "commands":
|
case "commands":
|
||||||
commands, err := cmd.Flags().GetStringSlice("commands")
|
commands, err := cmd.Flags().GetStringSlice(flag.Name)
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
defaults.Commands = commands
|
defaults.Commands = commands
|
||||||
case "sorting.by":
|
case "sorting.by":
|
||||||
defaults.Sorting.By = mustGetString(cmd, "sorting.by")
|
defaults.Sorting.By = mustGetString(cmd, flag.Name)
|
||||||
case "sorting.asc":
|
case "sorting.asc":
|
||||||
defaults.Sorting.Asc = mustGetBool(cmd, "sorting.asc")
|
defaults.Sorting.Asc = mustGetBool(cmd, flag.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue