// ListTasks lists all the tasks
ListTasks lists all the tasks
// ListTasks lists all the tasks
func ListTasks(path string, tag string, undoneOnly bool) error {
	tag = strings.ToLower(strings.TrimSpace(tag))
	tasks, err := ReadTasks(path)
	if err != nil {
		return err
	}
	fmt.Printf("\nid\tdate\t\tdone\ttodo\n")
	fmt.Printf("--\t----\t\t----\t----\n")
	for i, task := range tasks {
		line := fmt.Sprintf("%d\t%s\t[%s]\t%s", i+1, task.Date, task.Done, task.Name)
		if undoneOnly {
			if task.Done == "x" {
				continue 
			}
		}
		if tag != "" {
			if strings.Contains(strings.ToLower(line), tag) {
			} else {
				continue 
			}
		}
		fmt.Println(line)
	}
	fmt.Println("")
	return nil
}
func ListTasks ( path string , tag string , undoneOnly bool ) error { tag = strings . ToLower ( strings . TrimSpace ( tag ) ) tasks , err := ReadTasks ( path ) if err != nil { return err } fmt . Printf ( " \n \t \t \t \t \n " ) fmt . Printf ( " \t \t \t \t \n " ) for i , task := range tasks { line := fmt . Sprintf ( " \t \t \t " , i + 1 , task . Date , task . Done , task . Name ) if undoneOnly { if task . Done == " " { continue } } if tag != " " { if strings . Contains ( strings . ToLower ( line ) , tag ) { } else { continue } } fmt . Println ( line ) } fmt . Println ( " " ) return nil }
ListTasks lists all the tasks
ListTasks lists all the tasks
// Read from file // Print result // Status filtering // pass for done tasks // Tag filtering // print //skip