Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
kucukaslan committed Sep 29, 2023
1 parent c0b513e commit 5423eaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions item.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down
16 changes: 8 additions & 8 deletions todolist.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,30 @@ 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))
}
}
}
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))
}
}
}

0 comments on commit 5423eaf

Please sign in to comment.