Support multiple arguments to sync multiple days
parent
f1cc532f3d
commit
f7ecf95074
|
@ -99,14 +99,17 @@ async function apply_tasks_for_range(workspace: Workspace, interval: Interval, w
|
||||||
|
|
||||||
void (async function () {
|
void (async function () {
|
||||||
const config = await inferConfig()
|
const config = await inferConfig()
|
||||||
const interval = dateToInterval(process.argv.length > 2 ? process.argv[2] : 'today')
|
const args = process.argv.length > 2 ? process.argv.slice(2) : ["today"]
|
||||||
|
|
||||||
|
|
||||||
const marvin = new Marvin(Marvin.parseCredentials(config.marvin), config.marvinDB + "marvin")
|
const marvin = new Marvin(Marvin.parseCredentials(config.marvin), config.marvinDB + "marvin")
|
||||||
const tasks = await (marvin.root.category('Datakami').then(datakami => datakami.tasksOverlapping(interval)))
|
|
||||||
|
|
||||||
const toggl = new Toggl(config.toggl)
|
const toggl = new Toggl(config.toggl)
|
||||||
const workspaces = await toggl.workspaces()
|
const workspaces = await toggl.workspaces()
|
||||||
if (workspaces.length !== 1) throw new Error("not sure which workspace to use")
|
if (workspaces.length !== 1) throw new Error("not sure which workspace to use")
|
||||||
|
for (const arg of args) {
|
||||||
|
const interval = dateToInterval(arg)
|
||||||
|
const tasks = await (marvin.root.category('Datakami').then(datakami => datakami.tasksOverlapping(interval)))
|
||||||
|
|
||||||
const res_tasks: TogglTE[] = []
|
const res_tasks: TogglTE[] = []
|
||||||
for (const task of tasks)
|
for (const task of tasks)
|
||||||
|
@ -118,5 +121,6 @@ void (async function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
await apply_tasks_for_range(workspaces[0], interval, res_tasks)
|
await apply_tasks_for_range(workspaces[0], interval, res_tasks)
|
||||||
|
}
|
||||||
|
|
||||||
})()
|
})()
|
||||||
|
|
Loading…
Reference in New Issue