feedback add

This commit is contained in:
Erik Winter 2025-01-19 09:57:52 +01:00
parent a8220fd62b
commit 02219509df
2 changed files with 12 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/google/uuid"
"go-mod.ewintr.nl/planner/item"
"go-mod.ewintr.nl/planner/plan/format"
"go-mod.ewintr.nl/planner/sync/client"
)
@ -124,12 +125,15 @@ func (a Add) Do(repos Repositories, _ client.Client) (CommandResult, error) {
return nil, fmt.Errorf("could not add task: %v", err)
}
return AddRender{}, nil
return AddResult{
LocalID: localID,
}, nil
}
type AddRender struct {
type AddResult struct {
LocalID int
}
func (ar AddRender) Render() string {
return "stored task"
func (ar AddResult) Render() string {
return fmt.Sprintf("stored task %s", format.Bold(fmt.Sprintf("%d", ar.LocalID)))
}

View File

@ -95,3 +95,7 @@ func findTermWidth() int {
}
return width
}
func Bold(str string) string {
return fmt.Sprintf("\x1b[1;37m%s\x1b[0m", str)
}