Skip to content

Commit 8529afd

Browse files
author
Ashton Eby
committed
(bug) fix wrong taskwarrior binary for non-wsl systems
1 parent d328d1f commit 8529afd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

main.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default class EgoRock extends Plugin {
4545
this.addSettingTab(new EgoRockSettingsTab(this.app, this))
4646

4747
this.registerMarkdownCodeBlockProcessor('task-table', (source, element, context) => {
48-
this.doCommandReturnString(parseYaml(source).command, element, this.settings.taskBinaryPath)
48+
this.doCommandReturnString(parseYaml(source).command, element)
4949
})
5050
}
5151

@@ -112,10 +112,11 @@ export default class EgoRock extends Plugin {
112112
return [indices, rows]
113113
}
114114

115-
doCommandReturnString(commandString: string, el: any, taskwarriorBin='wsl task') {
115+
doCommandReturnString(commandString: string, el: any) {
116116
commandString = commandString.replace(/^task /, '')
117117
const reports = this.getReportNames()
118118
const report = commandString.split(' ').slice(-1)[0]
119+
const taskwarriorBin = this.settings.taskBinaryPath
119120
if (reports.includes(report)) {
120121
const newCommand = `${taskwarriorBin.trim()} rc.detection:off rc.defaultwidth:1000 ${commandString}`
121122
const asciiTable = execSync(newCommand).toString().split('\n')
@@ -131,9 +132,10 @@ export default class EgoRock extends Plugin {
131132
}
132133
}
133134

134-
doCommand(commandString: string, taskwarriorBin='wsl task') {
135+
doCommand(commandString: string) {
135136
const reports = this.getReportNames()
136137
const report = commandString.split(' ')[0]
138+
const taskwarriorBin = this.settings.taskBinaryPath
137139
if (reports.includes(report)) {
138140
const newCommand = `${taskwarriorBin.trim()} ${this.buildCommandForReport(report)}`
139141
return JSON.parse(execSync(newCommand).toString())
@@ -171,7 +173,8 @@ export default class EgoRock extends Plugin {
171173
}
172174

173175
getReports() {
174-
const lines = execSync('wsl task show report').toString().split('\n').filter(line => line.match(/^report\..+/))
176+
const taskwarriorBin = this.settings.taskBinaryPath
177+
const lines = execSync(`${taskwarriorBin} task show report`).toString().split('\n').filter(line => line.match(/^report\..+/))
175178
return lines
176179
}
177180

0 commit comments

Comments
 (0)