mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-12-22 07:58:08 +00:00
Parametrized Taskwarrior executable path (to be set in settings).
This commit is contained in:
parent
4a2e61d61b
commit
5a951fdbf4
1 changed files with 17 additions and 8 deletions
|
@ -6,6 +6,18 @@ import QOwnNotesTypes 1.0
|
||||||
* importing tasks from a certain project, or exporting them from a note.
|
* importing tasks from a certain project, or exporting them from a note.
|
||||||
*/
|
*/
|
||||||
QtObject {
|
QtObject {
|
||||||
|
property string myString;
|
||||||
|
|
||||||
|
property variant settingsVariables: [
|
||||||
|
{
|
||||||
|
"identifier": "taskPath",
|
||||||
|
"name": "Taskwarrior path",
|
||||||
|
"description": "A path to your Taskwarrior instance",
|
||||||
|
"type": "string",
|
||||||
|
"default": "/usr/bin/task",
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the custom actions
|
* Initializes the custom actions
|
||||||
*/
|
*/
|
||||||
|
@ -61,9 +73,6 @@ QtObject {
|
||||||
* @param identifier string the identifier defined in registerCustomAction
|
* @param identifier string the identifier defined in registerCustomAction
|
||||||
*/
|
*/
|
||||||
function customActionInvoked(identifier) {
|
function customActionInvoked(identifier) {
|
||||||
|
|
||||||
var pathToTaskwarrior = "/usr/bin/task";
|
|
||||||
|
|
||||||
switch (identifier) {
|
switch (identifier) {
|
||||||
// export selected lines to Taskwarriors as tasks.
|
// export selected lines to Taskwarriors as tasks.
|
||||||
// The project name will be taken from "Project:" keyword detected in first lines.
|
// The project name will be taken from "Project:" keyword detected in first lines.
|
||||||
|
@ -88,7 +97,7 @@ QtObject {
|
||||||
var isTask = taskRegExp.exec(line);
|
var isTask = taskRegExp.exec(line);
|
||||||
if (isTask) {
|
if (isTask) {
|
||||||
taskDescription = isTask[1];
|
taskDescription = isTask[1];
|
||||||
script.startDetachedProcess(pathToTaskwarrior,
|
script.startDetachedProcess(taskPath,
|
||||||
[
|
[
|
||||||
"add",
|
"add",
|
||||||
"pro:" + projectName,
|
"pro:" + projectName,
|
||||||
|
@ -115,10 +124,10 @@ QtObject {
|
||||||
script.noteTextEditWrite(script.noteTextEditSelectedText());
|
script.noteTextEditWrite(script.noteTextEditSelectedText());
|
||||||
|
|
||||||
projectNames.forEach( function(projectName) {
|
projectNames.forEach( function(projectName) {
|
||||||
var result = script.startSynchronousProcess(pathToTaskwarrior,
|
var result = script.startSynchronousProcess(taskPath,
|
||||||
[
|
[
|
||||||
"pro:" + projectName,
|
"pro.is:" + projectName,
|
||||||
"rc.report.next.columns=description",
|
"rc.report.next.columns=description.desc",
|
||||||
"rc.report.next.labels=Desc"
|
"rc.report.next.labels=Desc"
|
||||||
],
|
],
|
||||||
"");
|
"");
|
||||||
|
@ -141,7 +150,7 @@ QtObject {
|
||||||
|
|
||||||
script.noteTextEditWrite("\n");
|
script.noteTextEditWrite("\n");
|
||||||
|
|
||||||
script.noteTextEditWrite("Project: " + projectName + "\n\n");
|
script.noteTextEditWrite("# " + projectName + "\n\n");
|
||||||
tasksSeparated.forEach( function(taskDesc){
|
tasksSeparated.forEach( function(taskDesc){
|
||||||
script.noteTextEditWrite("* " + taskDesc + "\n");
|
script.noteTextEditWrite("* " + taskDesc + "\n");
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue