Skip to content
Snippets Groups Projects
Commit a2d0eeb6 authored by Florent Gluck's avatar Florent Gluck
Browse files

Fixed: nexush bug: "-l" argument is not handled properly

parent 6f9f04b5
No related branches found
No related tags found
No related merge requests found
...@@ -48,11 +48,6 @@ func printFilteredTemplates(c cmd.Command, args []string, route string) int { ...@@ -48,11 +48,6 @@ func printFilteredTemplates(c cmd.Command, args []string, route string) int {
return 1 return 1
} }
// Helper function to remove an element from a string array at a given index
removeArgAtIndex := func (slice []string, index int) []string {
return append(slice[:index], slice[index+1:]...)
}
// Check if a "-l" argument is specified // Check if a "-l" argument is specified
foundLongOutputFlag := -1 foundLongOutputFlag := -1
for idx, arg := range args { for idx, arg := range args {
...@@ -62,7 +57,7 @@ func printFilteredTemplates(c cmd.Command, args []string, route string) int { ...@@ -62,7 +57,7 @@ func printFilteredTemplates(c cmd.Command, args []string, route string) int {
} }
if foundLongOutputFlag >= 0 { if foundLongOutputFlag >= 0 {
removeArgAtIndex(args, foundLongOutputFlag) args = u.RemoveArgAtIndex(args, foundLongOutputFlag)
} }
templates, err := getFilteredTemplates(route, args) templates, err := getFilteredTemplates(route, args)
......
...@@ -53,11 +53,6 @@ func printFilteredUsers(c cmd.Command, args []string, route string) int { ...@@ -53,11 +53,6 @@ func printFilteredUsers(c cmd.Command, args []string, route string) int {
return 1 return 1
} }
// Helper function to remove an element from a string array at a given index
removeArgAtIndex := func(slice []string, index int) []string {
return append(slice[:index], slice[index+1:]...)
}
// Check if a "-l" argument is specified // Check if a "-l" argument is specified
foundLongOutputFlag := -1 foundLongOutputFlag := -1
for idx, arg := range args { for idx, arg := range args {
...@@ -67,7 +62,7 @@ func printFilteredUsers(c cmd.Command, args []string, route string) int { ...@@ -67,7 +62,7 @@ func printFilteredUsers(c cmd.Command, args []string, route string) int {
} }
if foundLongOutputFlag >= 0 { if foundLongOutputFlag >= 0 {
removeArgAtIndex(args, foundLongOutputFlag) args = u.RemoveArgAtIndex(args, foundLongOutputFlag)
} }
client := g.GetInstance().Client client := g.GetInstance().Client
......
...@@ -41,11 +41,6 @@ func printFilteredVMs(c cmd.Command, args []string, route string) int { ...@@ -41,11 +41,6 @@ func printFilteredVMs(c cmd.Command, args []string, route string) int {
return 1 return 1
} }
// Helper function to remove an element from a string array at a given index
removeArgAtIndex := func (slice []string, index int) []string {
return append(slice[:index], slice[index+1:]...)
}
// Check if a "-l" argument is specified // Check if a "-l" argument is specified
foundLongOutputFlag := -1 foundLongOutputFlag := -1
for idx, arg := range args { for idx, arg := range args {
...@@ -55,7 +50,7 @@ func printFilteredVMs(c cmd.Command, args []string, route string) int { ...@@ -55,7 +50,7 @@ func printFilteredVMs(c cmd.Command, args []string, route string) int {
} }
if foundLongOutputFlag >= 0 { if foundLongOutputFlag >= 0 {
removeArgAtIndex(args, foundLongOutputFlag) args = u.RemoveArgAtIndex(args, foundLongOutputFlag)
} }
vms, err := getFilteredVMs(route, args) vms, err := getFilteredVMs(route, args)
......
...@@ -130,3 +130,8 @@ func FileToString(file string) (string, error) { ...@@ -130,3 +130,8 @@ func FileToString(file string) (string, error) {
} }
return string(content), nil return string(content), nil
} }
// Removes an element from a string array at a given index
func RemoveArgAtIndex(slice []string, index int) []string {
return append(slice[:index], slice[index+1:]...)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment