diff --git a/plan/command/add.go b/plan/command/add.go index e5a8688..d5ff520 100644 --- a/plan/command/add.go +++ b/plan/command/add.go @@ -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))) } diff --git a/plan/format/format.go b/plan/format/format.go index 5b5e955..fd6c2fc 100644 --- a/plan/format/format.go +++ b/plan/format/format.go @@ -95,3 +95,7 @@ func findTermWidth() int { } return width } + +func Bold(str string) string { + return fmt.Sprintf("\x1b[1;37m%s\x1b[0m", str) +}