-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: lift and list tasks can fetch default tasks file; fetch will us…
…e the default tasks file name when none is provided
- Loading branch information
Showing
4 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Task } from '../definitions'; | ||
import { fetch } from '../utils/fetch'; | ||
import { Empty, TypeGuard } from 'type-core'; | ||
|
||
export async function getTaskRecord( | ||
tasks: string | Task.Record | Empty | ||
): Promise<Task.Record> { | ||
if (TypeGuard.isRecord(tasks)) { | ||
return tasks; | ||
} | ||
if (TypeGuard.isString(tasks) || TypeGuard.isEmpty(tasks)) { | ||
return fetch(tasks); | ||
} | ||
throw Error(`A valid task record or path to a tasks file must be provided`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters