mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-09-13 14:59:09 +00:00
Add CreatedTimestamp and ModifiedTimestamp Columns to list commands
This commit is contained in:
parent
423dfb020c
commit
d142f14ccc
4 changed files with 24 additions and 4 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/passbolt/go-passbolt-cli/util"
|
||||
|
@ -29,7 +30,7 @@ func init() {
|
|||
UserListCmd.Flags().StringP("search", "s", "", "Search for Users")
|
||||
UserListCmd.Flags().BoolP("admin", "a", false, "Only show Admins")
|
||||
|
||||
UserListCmd.Flags().StringArrayP("column", "c", []string{"ID", "Username", "FirstName", "LastName", "Role"}, "Columns to return, possible Columns:\nID, Username, FirstName, LastName, Role")
|
||||
UserListCmd.Flags().StringArrayP("column", "c", []string{"ID", "Username", "FirstName", "LastName", "Role"}, "Columns to return, possible Columns:\nID, Username, FirstName, LastName, Role, CreatedTimestamp, ModifiedTimestamp")
|
||||
}
|
||||
|
||||
func UserList(cmd *cobra.Command, args []string) error {
|
||||
|
@ -92,6 +93,10 @@ func UserList(cmd *cobra.Command, args []string) error {
|
|||
entry[i] = shellescape.StripUnsafe(user.Profile.LastName)
|
||||
case "role":
|
||||
entry[i] = shellescape.StripUnsafe(user.Role.Name)
|
||||
case "createdtimestamp":
|
||||
entry[i] = user.Created.Format(time.RFC3339)
|
||||
case "modifiedtimestamp":
|
||||
entry[i] = user.Modified.Format(time.RFC3339)
|
||||
default:
|
||||
cmd.SilenceUsage = false
|
||||
return fmt.Errorf("Unknown Column: %v", columns[i])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue