Taskwarrior Project Templates? Yes Please!

Posted on Sep 2, 2019
Share Tweet

Creating a project template from an executable file

First, open a new file using nano:

sudo nano videofile

Next, add your tasks, separated by a new line:

record video
edit video
upload video

Then just add “task add” to the front of each line:

task add record video
task add edit video
task add upload video

Now exit the file and save:

ctrl + x
y

And now we can make the file executable:


Now we can create all those tasks simply by executing that file:

`./videofile`

NOW, in order to bake in the dependencies, we need to add some stuff to the line items in the file. So we go back into that file:

```sudo nano videofile```

And change the first line to

```recordstring=`task add record video````

Then enter a new line beneath that:

```recordid=`echo $recordstring | grep -o -E '[0-9]+'````

Then just repeat that process for each task.

The last thing we need to do is use the variable for the _id_ in the creation of the task. So the task for editing the video will look like this:

editstring=task add edit video $recordid editid=echo $recordstring | grep -o -E '[0-9]+' ``

Etc.

Drop a comment below if you have any questions.



Check out these related posts