From 5423eaf58b807e18c732f0ceccd3052da2b57312 Mon Sep 17 00:00:00 2001 From: Muhammed Can Kucukaslan Date: Fri, 29 Sep 2023 18:12:12 +0300 Subject: [PATCH] fix typo --- item.go | 4 ++-- todolist.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/item.go b/item.go index ac42e77..b795bde 100644 --- a/item.go +++ b/item.go @@ -19,7 +19,7 @@ func (i *item) toString() string { return str } -func (i *item) toFormattedString(seperator string, iW, tW, dW int) string { +func (i *item) toFormattedString(separator string, iW, tW, dW int) string { strDate := i.Date date, err := time.Parse(time.RFC3339, strDate) // If the date is parsed then convert it @@ -44,7 +44,7 @@ func (i *item) toFormattedString(seperator string, iW, tW, dW int) string { strDate = "Just now" } } - str := fmt.Sprintf("%-*d"+seperator+" %-*s"+seperator+" %-*s", iW, i.Id, tW, i.Title, dW, strDate) + str := fmt.Sprintf("%-*d"+separator+" %-*s"+separator+" %-*s", iW, i.Id, tW, i.Title, dW, strDate) return str } diff --git a/todolist.go b/todolist.go index b43eac3..d379d91 100644 --- a/todolist.go +++ b/todolist.go @@ -96,14 +96,14 @@ func (td *TodoList) printInComplete() { iW := 6 tW := 30 dW := 20 - seperator := "|" - str := fmt.Sprintf("%-*s"+seperator+" %-*s"+seperator+" %-*s", iW, "Id", tW, "Title", dW, "Date") - // + 1 for the extra space following the seperator + separator := "|" + str := fmt.Sprintf("%-*s"+separator+" %-*s"+separator+" %-*s", iW, "Id", tW, "Title", dW, "Date") + // + 1 for the extra space following the separator str += fmt.Sprintf("\n%s:%s:%s", strings.Repeat("-", iW), strings.Repeat("-", 1+tW), strings.Repeat("-", 1+dW)) fmt.Println(str) for _, item := range *td { if !item.Status { - fmt.Println(item.toFormattedString(seperator, iW, tW, dW)) + fmt.Println(item.toFormattedString(separator, iW, tW, dW)) } } } @@ -111,15 +111,15 @@ func (td *TodoList) printComplete() { iW := 6 tW := 30 dW := 20 - seperator := "|" - str := fmt.Sprintf("%-*s"+seperator+" %-*s"+seperator+" %-*s", iW, "Id", tW, "Title", dW, "Date") - // + 1 for the extra space following the seperator + separator := "|" + str := fmt.Sprintf("%-*s"+separator+" %-*s"+separator+" %-*s", iW, "Id", tW, "Title", dW, "Date") + // + 1 for the extra space following the separator str += fmt.Sprintf("\n%s:%s:%s", strings.Repeat("-", iW), strings.Repeat("-", 1+tW), strings.Repeat("-", 1+dW)) fmt.Println(str) for _, item := range *td { if item.Status { - fmt.Println(item.toFormattedString(seperator, iW, tW, dW)) + fmt.Println(item.toFormattedString(separator, iW, tW, dW)) } } }