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

client: usersetcaps, vmaddaccess now display capabilities in alphabetical...

client: usersetcaps, vmaddaccess now display capabilities in alphabetical order; fixed missing carriage return in usersetcaps
Bumpped client to version 1.11.1
parent 1aedd3b3
Branches
No related tags found
No related merge requests found
...@@ -41,18 +41,20 @@ List of user capabilities: ...@@ -41,18 +41,20 @@ List of user capabilities:
` `
caps := caps.GetUserCapsNames() caps := caps.GetUserCapsNames()
i := 0 i := 0
count := 0
for _, v := range caps { for _, v := range caps {
if (i == 0) { if (i == 0) {
usage += " " usage += " "
} }
usage += v + " " usage += v + " "
i += 1 i += 1
if (i >= 5) { count += 1
if (i >= 5 && count < len(caps)) {
usage = u.AppendNewLine(usage) usage = u.AppendNewLine(usage)
i = 0 i = 0
} }
} }
u.PrintErr(usage) u.PrintlnErr(usage)
} }
func (cmd *SetCaps)Run(args []string) int { func (cmd *SetCaps)Run(args []string) int {
......
...@@ -43,18 +43,20 @@ List of VM access capabilities: ...@@ -43,18 +43,20 @@ List of VM access capabilities:
` `
caps := caps.GetVMAccessCapsNames() caps := caps.GetVMAccessCapsNames()
i := 0 i := 0
count := 0
for _, v := range caps { for _, v := range caps {
if (i == 0) { if (i == 0) {
usage += " " usage += " "
} }
usage += v + " " usage += v + " "
i += 1 i += 1
if (i >= 5) { count += 1
if (i >= 5 && count < len(caps)) {
usage = u.AppendNewLine(usage) usage = u.AppendNewLine(usage)
i = 0 i = 0
} }
} }
u.PrintErr(usage) u.PrintlnErr(usage)
printRegexUsageDetails() printRegexUsageDetails()
} }
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
const ( const (
major = 1 major = 1
minor = 11 minor = 11
bugfix = 0 bugfix = 1
) )
var version params.Version = params.NewVersion(major, minor, bugfix) var version params.Version = params.NewVersion(major, minor, bugfix)
......
package caps package caps
import ( import (
"sort"
"errors" "errors"
) )
...@@ -131,6 +132,12 @@ func GetUserCapsNames() []string { ...@@ -131,6 +132,12 @@ func GetUserCapsNames() []string {
for key, _ := range userCaps { for key, _ := range userCaps {
caps = append(caps, key) caps = append(caps, key)
} }
// Sort caps by name
sort.Slice(caps, func(i, j int) bool {
return caps[i] < caps[j]
})
return caps return caps
} }
...@@ -139,5 +146,11 @@ func GetVMAccessCapsNames() []string { ...@@ -139,5 +146,11 @@ func GetVMAccessCapsNames() []string {
for key, _ := range vmAccessCaps { for key, _ := range vmAccessCaps {
caps = append(caps, key) caps = append(caps, key)
} }
// Sort caps by name
sort.Slice(caps, func(i, j int) bool {
return caps[i] < caps[j]
})
return caps return caps
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment