mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 02:58:20 +00:00
Merge pull request #19 from passbolt/feature-add-created-modified-timestamp-columns
Add CreatedTimestamp and ModifiedTimestamp Columns to list commands
This commit is contained in:
commit
45fe21119b
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"
|
||||
|
@ -26,7 +27,7 @@ func init() {
|
|||
FolderListCmd.Flags().StringP("search", "s", "", "Folders that have this in the Name")
|
||||
FolderListCmd.Flags().StringArrayP("folder", "f", []string{}, "Folders that are in this Folder")
|
||||
FolderListCmd.Flags().StringArrayP("group", "g", []string{}, "Folders that are shared with group")
|
||||
FolderListCmd.Flags().StringArrayP("column", "c", []string{"ID", "FolderParentID", "Name"}, "Columns to return, possible Columns:\nID, FolderParentID, Name")
|
||||
FolderListCmd.Flags().StringArrayP("column", "c", []string{"ID", "FolderParentID", "Name"}, "Columns to return, possible Columns:\nID, FolderParentID, Name, CreatedTimestamp, ModifiedTimestamp")
|
||||
}
|
||||
|
||||
func FolderList(cmd *cobra.Command, args []string) error {
|
||||
|
@ -75,6 +76,10 @@ func FolderList(cmd *cobra.Command, args []string) error {
|
|||
entry[i] = folder.FolderParentID
|
||||
case "name":
|
||||
entry[i] = shellescape.StripUnsafe(folder.Name)
|
||||
case "createdtimestamp":
|
||||
entry[i] = folder.Created.Format(time.RFC3339)
|
||||
case "modifiedtimestamp":
|
||||
entry[i] = folder.Modified.Format(time.RFC3339)
|
||||
default:
|
||||
cmd.SilenceUsage = false
|
||||
return fmt.Errorf("Unknown Column: %v", columns[i])
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/passbolt/go-passbolt-cli/util"
|
||||
|
@ -26,7 +27,7 @@ func init() {
|
|||
GroupListCmd.Flags().StringArrayP("user", "u", []string{}, "Groups that are shared with group")
|
||||
GroupListCmd.Flags().StringArrayP("manager", "m", []string{}, "Groups that are in folder")
|
||||
|
||||
GroupListCmd.Flags().StringArrayP("column", "c", []string{"ID", "Name"}, "Columns to return, possible Columns:\nID, Name")
|
||||
GroupListCmd.Flags().StringArrayP("column", "c", []string{"ID", "Name"}, "Columns to return, possible Columns:\nID, Name, CreatedTimestamp, ModifiedTimestamp")
|
||||
}
|
||||
|
||||
func GroupList(cmd *cobra.Command, args []string) error {
|
||||
|
@ -73,6 +74,10 @@ func GroupList(cmd *cobra.Command, args []string) error {
|
|||
entry[i] = group.ID
|
||||
case "name":
|
||||
entry[i] = shellescape.StripUnsafe(group.Name)
|
||||
case "createdtimestamp":
|
||||
entry[i] = group.Created.Format(time.RFC3339)
|
||||
case "modifiedtimestamp":
|
||||
entry[i] = group.Modified.Format(time.RFC3339)
|
||||
default:
|
||||
cmd.SilenceUsage = false
|
||||
return fmt.Errorf("Unknown Column: %v", columns[i])
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/passbolt/go-passbolt-cli/util"
|
||||
|
@ -30,7 +31,7 @@ func init() {
|
|||
ResourceListCmd.Flags().StringP("group", "g", "", "Resources that are shared with group")
|
||||
ResourceListCmd.Flags().StringArrayP("folder", "f", []string{}, "Resources that are in folder")
|
||||
|
||||
ResourceListCmd.Flags().StringArrayP("column", "c", []string{"ID", "FolderParentID", "Name", "Username", "URI"}, "Columns to return, possible Columns:\nID, FolderParentID, Name, Username, URI, Password, Description")
|
||||
ResourceListCmd.Flags().StringArrayP("column", "c", []string{"ID", "FolderParentID", "Name", "Username", "URI"}, "Columns to return, possible Columns:\nID, FolderParentID, Name, Username, URI, Password, Description, CreatedTimestamp, ModifiedTimestamp")
|
||||
}
|
||||
|
||||
func ResourceList(cmd *cobra.Command, args []string) error {
|
||||
|
@ -105,6 +106,10 @@ func ResourceList(cmd *cobra.Command, args []string) error {
|
|||
return fmt.Errorf("Get Resource %w", err)
|
||||
}
|
||||
entry[i] = shellescape.StripUnsafe(desc)
|
||||
case "createdtimestamp":
|
||||
entry[i] = resource.Created.Format(time.RFC3339)
|
||||
case "modifiedtimestamp":
|
||||
entry[i] = resource.Modified.Format(time.RFC3339)
|
||||
default:
|
||||
cmd.SilenceUsage = false
|
||||
return fmt.Errorf("Unknown Column: %v", columns[i])
|
||||
|
|
|
@ -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
Reference in a new issue