aboutsummaryrefslogtreecommitdiffstats
path: root/commands/user_ls.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/user_ls.go')
-rw-r--r--commands/user_ls.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/commands/user_ls.go b/commands/user_ls.go
index 9d0eebf1..353bc101 100644
--- a/commands/user_ls.go
+++ b/commands/user_ls.go
@@ -22,6 +22,8 @@ func runUserLs(_ *cobra.Command, _ []string) error {
interrupt.RegisterCleaner(backend.Close)
switch userLsOutputFormat {
+ case "org-mode":
+ return userLsOrgmodeFormatter(backend)
case "json":
return userLsJsonFormatter(backend)
case "plain":
@@ -93,6 +95,22 @@ func userLsJsonFormatter(backend *cache.RepoCache) error {
return nil
}
+func userLsOrgmodeFormatter(backend *cache.RepoCache) error {
+ for _, id := range backend.AllIdentityIds() {
+ i, err := backend.ResolveIdentityExcerpt(id)
+ if err != nil {
+ return err
+ }
+
+ fmt.Printf("* %s %s\n",
+ i.Id.Human(),
+ i.DisplayName(),
+ )
+ }
+
+ return nil
+}
+
var userLsCmd = &cobra.Command{
Use: "ls",
Short: "List identities.",
@@ -104,5 +122,5 @@ func init() {
userCmd.AddCommand(userLsCmd)
userLsCmd.Flags().SortFlags = false
userLsCmd.Flags().StringVarP(&userLsOutputFormat, "format", "f", "default",
- "Select the output formatting style. Valid values are [default,plain,json]")
+ "Select the output formatting style. Valid values are [default,plain,json,org-mode]")
}