// ChangeTaskStatus changes the task status with done[x]/undone[ ]
ChangeTaskStatus changes the task status with done[x]/undone[ ]
// ChangeTaskStatus changes the task status with done [ x ] / undone [ ]
func ChangeTaskStatus(path string, ids []int, status string) error {
	var jobs []string
	tasks, err := ReadTasks(path)
	if err != nil {
		return err
	}
	statusMap := make(map[int]bool)
	for _, id := range ids {
		id = id - 1 
		statusMap[id] = true
	}
	for i, task := range tasks {
		if _, ok := statusMap[i]; ok {
			tasks[i].Done = status
			jobs = append(jobs, task.Name)
		}
	}
	err = WriteTasks(path, tasks, true)
	if err != nil {
		return err
	}
	if status == "x" {
		fmt.Printf("\nDone: \n")
	} else {
		fmt.Printf("\nUndone: \n")
	}
	for _, job := range jobs {
		fmt.Printf("\t%s\n", job)
	}
	return nil
}
func ChangeTaskStatus ( path string , ids [ ] int , status string ) error { var jobs [ ] string tasks , err := ReadTasks ( path ) if err != nil { return err } statusMap := make ( map [ int ] bool ) for _ , id := range ids { id = id - 1 statusMap [ id ] = true } for i , task := range tasks { if _ , ok := statusMap [ i ] ; ok { tasks [ i ] . Done = status jobs = append ( jobs , task . Name ) } } err = WriteTasks ( path , tasks , true ) if err != nil { return err } if status == " " { fmt . Printf ( " \n \n " ) } else { fmt . Printf ( " \n \n " ) } for _ , job := range jobs { fmt . Printf ( " \t \n " , job ) } return nil }
ChangeTaskStatus changes the task status with done[x]/undone[ ]
ChangeTaskStatus changes the task status with done [ x ] / undone [ ]
// Read from file // Create remove map // index 0 // Update status // Write to file // Print status