From 02219509df631ef0f4d0fc6d967fb0f133307437 Mon Sep 17 00:00:00 2001 From: Erik Winter Date: Sun, 19 Jan 2025 09:57:52 +0100 Subject: [PATCH] feedback add --- plan/command/add.go | 12 ++++++++---- plan/format/format.go | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) 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) +}