feat(cli): add nib add + nib ls commands
Default command delegation: `nib "..."` routes to `nib add`. Capture bar parses grammar, creates entities. `nib ls` lists with date grouping, tag filter, 48h default window. Display glyphs for all entity types.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package display
|
||||
|
||||
import "github.com/lerko/nib/internal/db"
|
||||
|
||||
var glyphMap = map[db.Glyph]string{
|
||||
db.GlyphNote: "◦",
|
||||
db.GlyphTodo: "▸",
|
||||
db.GlyphEvent: "◇",
|
||||
}
|
||||
|
||||
var cardGlyphMap = map[db.CardType]string{
|
||||
db.CardSnippet: "◆",
|
||||
db.CardTemplate: "◈",
|
||||
db.CardChecklist: "☐",
|
||||
db.CardDecision: "⚖",
|
||||
db.CardLink: "🔗",
|
||||
}
|
||||
|
||||
func DisplayGlyph(glyph db.Glyph, cardType *db.CardType) string {
|
||||
if cardType != nil {
|
||||
if g, ok := cardGlyphMap[*cardType]; ok {
|
||||
return g
|
||||
}
|
||||
}
|
||||
if g, ok := glyphMap[glyph]; ok {
|
||||
return g
|
||||
}
|
||||
return "◦"
|
||||
}
|
||||
|
||||
func FormatID(id string) string {
|
||||
if len(id) > 6 {
|
||||
return id[:6]
|
||||
}
|
||||
return id
|
||||
}
|
||||
Reference in New Issue
Block a user