The Powerful Interface in Go — Inspired by a Simple Todo CLI Tool
I am building an Todo CLI tool recently and used Go’s powerful interface to achieve better formatting. Previously my cli looks like: $ ./todo -list Another ToDo item Improve usage Improve output And the code looks like: l := &todo.List{} switch { case *list: for _, t := range *l { if !t.Done { fmt.Println(t.Task) } } But I don’t just want to print out the items I put inside the list, I want to items printed out with number and a mark “X” to indicate if the item was completed or not....