Add GetSlice function

This commit is contained in:
Brian Buller 2023-08-23 07:59:18 -05:00
parent 30978b9c94
commit 11f1335a20

View File

@ -196,6 +196,14 @@ func (tasklist *TaskList) ArchiveTaskToFile(task Task, filename string) error {
return err return err
} }
func (tasklist *TaskList) GetTaskSlice() []*Task {
var res []*Task
for _, t := range *tasklist {
res = append(res, &t)
}
return res
}
// LoadFromFile loads and returns a TaskList from *os.File. // LoadFromFile loads and returns a TaskList from *os.File.
// //
// Using *os.File instead of a filename allows to also use os.Stdin. // Using *os.File instead of a filename allows to also use os.Stdin.