mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-07-13 05:09:09 +00:00
add shellescapse, update deps
This commit is contained in:
parent
bf4a0c8d4a
commit
f373792c06
10 changed files with 182 additions and 85 deletions
11
user/get.go
11
user/get.go
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/speatzle/go-passbolt-cli/util"
|
||||
"github.com/speatzle/go-passbolt/helper"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -38,7 +39,7 @@ func UserGet(cmd *cobra.Command, args []string) error {
|
|||
defer client.Logout(context.TODO())
|
||||
cmd.SilenceUsage = true
|
||||
|
||||
username, firstname, lastname, role, err := helper.GetUser(
|
||||
role, username, firstname, lastname, err := helper.GetUser(
|
||||
ctx,
|
||||
client,
|
||||
id,
|
||||
|
@ -46,10 +47,10 @@ func UserGet(cmd *cobra.Command, args []string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("Getting User: %w", err)
|
||||
}
|
||||
fmt.Printf("Username: %v\n", username)
|
||||
fmt.Printf("FirstName: %v\n", firstname)
|
||||
fmt.Printf("LastName: %v\n", lastname)
|
||||
fmt.Printf("Role: %v\n", role)
|
||||
fmt.Printf("Username: %v\n", shellescape.StripUnsafe(username))
|
||||
fmt.Printf("FirstName: %v\n", shellescape.StripUnsafe(firstname))
|
||||
fmt.Printf("LastName: %v\n", shellescape.StripUnsafe(lastname))
|
||||
fmt.Printf("Role: %v\n", shellescape.StripUnsafe(role))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/speatzle/go-passbolt-cli/util"
|
||||
"github.com/speatzle/go-passbolt/api"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -84,13 +85,13 @@ func UserList(cmd *cobra.Command, args []string) error {
|
|||
case "id":
|
||||
entry[i] = user.ID
|
||||
case "username":
|
||||
entry[i] = user.Username
|
||||
entry[i] = shellescape.StripUnsafe(user.Username)
|
||||
case "firstname":
|
||||
entry[i] = user.Profile.FirstName
|
||||
entry[i] = shellescape.StripUnsafe(user.Profile.FirstName)
|
||||
case "lastname":
|
||||
entry[i] = user.Profile.LastName
|
||||
entry[i] = shellescape.StripUnsafe(user.Profile.LastName)
|
||||
case "role":
|
||||
entry[i] = user.Role.Name
|
||||
entry[i] = shellescape.StripUnsafe(user.Role.Name)
|
||||
default:
|
||||
cmd.SilenceUsage = false
|
||||
return fmt.Errorf("Unknown Column: %v", columns[i])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue