-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
726f9f0
commit 0b86242
Showing
3 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{"UI tags":{"id":"UI tags","description":"filter the items by tags in the UI, listing the tags for selection","duration":0,"done":false,"tags":{}},"list tags":{"id":"list tags","description":"command like 'godo list tag1 tag2 tag3' that lists items in tags","duration":1800000000000,"done":true,"tags":{}},"ordering":{"id":"ordering","description":"sort by custom order","duration":0,"done":false,"tags":{}},"tags":{"id":"tags","description":"command like 'godo tags' that lists the existing tags","duration":0,"done":false,"tags":{}},"untag":{"id":"untag","description":"command like tag but deletes the tag from items","duration":5400000000000,"done":true,"tags":{}}} | ||
":{}}} | ||
ription":"command like tag but deletes the tag from items","duration":5400000000000,"done":true,"tags":{}}} | ||
{"UI tags":{"id":"UI tags","description":"filter the items by tags in the UI, listing the tags for selection","duration":0,"done":false,"tags":{}},"list tags":{"id":"list tags","description":"command like 'godo list tag1 tag2 tag3' that lists items in tags","duration":1800000000000,"done":true,"tags":{}},"ordering":{"id":"ordering","description":"sort by custom order","duration":0,"done":false,"tags":{}},"tags":{"id":"tags","description":"command like 'godo tags' that lists the existing tags","duration":0,"done":true,"tags":{}},"untag":{"id":"untag","description":"command like tag but deletes the tag from items","duration":5400000000000,"done":true,"tags":{}}} | ||
|
||
K":{}}}} | ||
K":{}}}} | ||
RK":{}}}} | ||
RK":{}}}} | ||
RK":{}}}} | ||
e tag from items","duration":5400000000000,"done":true,"tags":{}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gabrielseibel1/godo/data" | ||
"github.com/gabrielseibel1/godo/types" | ||
"golang.org/x/exp/maps" | ||
) | ||
|
||
const CatCommandName CommandName = "cat" | ||
|
||
type Cat struct { | ||
repo data.Repository | ||
} | ||
|
||
func (c *Cat) Parameterize(args []string) error { | ||
if len(args) != 0 { | ||
return errArgsCount(0, len(args)) | ||
} | ||
return nil | ||
} | ||
|
||
func (c *Cat) Execute() error { | ||
as, err := c.repo.List() | ||
if err != nil { | ||
return err | ||
} | ||
tags := make(map[types.ID]struct{}) | ||
for _, a := range as { | ||
maps.Copy(tags, a.Tags()) | ||
} | ||
for tag := range tags { | ||
fmt.Println(tag) | ||
} | ||
return nil | ||
} | ||
|
||
func (c *Cat) String() string { | ||
return fmt.Sprintf("command %s", CatCommandName) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters