Reduce copying args when global
This commit is contained in:
1 parent
e9506e80cb
commit
71763e18f6
1 file changed
+2
-3
@@ -150,7 +150,7 @@ func getEnvironment(appName string, merged bool) (env *Env) {
|
|||||||
|
|
||||||
//getCommonArgs extracts common positional args (appName and keys)
|
//getCommonArgs extracts common positional args (appName and keys)
|
||||||
func getCommonArgs(global bool, args []string) (appName string, keys []string) {
|
func getCommonArgs(global bool, args []string) (appName string, keys []string) {
|
||||||
nextArg := 0
|
keys = args
|
||||||
if !global {
|
if !global {
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
appName = args[0]
|
appName = args[0]
|
||||||
@@ -158,9 +158,8 @@ func getCommonArgs(global bool, args []string) (appName string, keys []string) {
|
|||||||
if appName == "" {
|
if appName == "" {
|
||||||
common.LogFail("Please specify an app or --global")
|
common.LogFail("Please specify an app or --global")
|
||||||
} else {
|
} else {
|
||||||
nextArg++
|
keys = args[1:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keys = args[nextArg:]
|
|
||||||
return appName, keys
|
return appName, keys
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user