From 94619341f21421c3d56cd8f93f5e9accd6b83a89 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Sun, 6 Jan 2019 12:41:52 +0000 Subject: [PATCH] feat: simplify future changes License: MIT Signed-off-by: Henrique Dias Former-commit-id: 1fef9a9903b88ce216c4863a2c13d18030883f01 [formerly ab968c3e733db147d0e185934f03e7f965e03fde] [formerly a8e8e77ed08ca600abc156ba1cd57aff1af9d5c5 [formerly 12eb050cc22baeda292a25034821aa0d7640ca84]] Former-commit-id: eeb1864fb4c2c0d981c657a54c2d1e2a83a260e7 [formerly 09d661a1172e93b8e6a627dff2870b1e1c5903c6] Former-commit-id: 5974a6e8e1309855e58160e6fa827de6dc5b9605 --- cmd/users.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/users.go b/cmd/users.go index e497e82b..f49f46e4 100644 --- a/cmd/users.go +++ b/cmd/users.go @@ -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) } }