¿Cómo agregar múltiples tareas en un comando en Taskwarrior?

¿Cómo agregar múltiples tareas en un comando en Taskwarrior?

¿Cómo puedo agregar varias tareas en una línea de comando enguerrero de tareas?

Me gustaría lograr algo como:

task add task1 tag:tag1, task2 tag:tag2

Creo que debería haber un delimitador para separar tareas.

Respuesta1

Si literalmente solo necesitas hacer esto en una línea, puedes hacer:

task add "Get some foo"; task add "Get some bar"

Esto solo usa el ;token nativo del shell.

Respuesta2

No sé si todavía estás interesado en esto. Creé un script de bash shell bastante rápido que se adaptaba a mis propósitos en ese momento. Le pregunta si desea configurar un proyecto o etiquetas para las tareas y luego crea rápidamente varias tareas nuevas. Utiliza algunas combinaciones de colores bastante llamativas, creo que acababa de descubrir el método "echo -e " en ese momento; o)

Estuve buscando hoy y encontré tu publicación porque quería desarrollar el script para hacer dependencias, pero parece que tendré que aprender Python; También quiero sincronizar algunos recordatorios de Google. Si ha encontrado una buena herramienta, me alegraría saber qué solución eligió.

kr A


#!/bin/bash

#  Script:  twmulti
#  Created: 2016.02.11
#  Current: ~/Bin

#   clear the variables just in case a recent session set them
PRJNAME=""
TAGNAME=""
TSKNAME=""

clear

echo -e "\e[1;33;41mENTER PROJECT NAME >\e[0;m" 
read PRJNAME
if [ -z $PRJNAME ] ; then PRJNAME="" ; fi

echo -e "\n\e[1;33;41mENTER ANY TAG(S)  >\e[0;m" 
read TEMPTAGNAME
TAGNAME="+"`echo $TEMPTAGNAME | sed 's/ / +/g'`
if [ -z $TEMPTAGNAME ] ; then TAGNAME=""; fi

while :
do
    clear 
    echo -e "\e[1;33;41mENTER TASK DESCRIPTION (Project:$PRJNAME) >\e[0;m"
    echo -e "\e[1;33;41mor enter again to quit\e[0;m"
    read TSKNAME
        if [ -z $TSKNAME ] ; then exit ; fi 
        task add project\:$PRJNAME $TAGNAME $TSKNAME 1>/dev/null
    echo -e "\e[0;m"
done

Respuesta3

Como @Sardathrion señaló en el comentario, esto se vería así:

for i in "task 1" "task 2" "task 3"; do task add "$i"; done

Respuesta4

Con la esperanza de que esto pueda ayudar a alguien, puede utilizarlo task importpara ese caso de uso. Desde taskla página de manual de:

       task import [<file> ...]
              Imports tasks in the JSON format.  Can be used to add new tasks, or update existing ones.  Tasks are identified by their UUID.

              If no file or "-" is specified, import tasks from STDIN.

              Setting rc.recurrence.confirmation to an appropriate level is recommended if import is to be used in automated workflows.  See taskrc(5).

              For importing other file formats, the standard task release comes with a few example scripts, such as:

                import-todo.sh.pl
                import-yaml.pl

Entonces, puedes hacer algo como esto:

$ echo '[{"description":"task1"},{"description":"task2"}]' |task import -
Importing 'STDIN'
 add  bfc337ce-b446-453d-8cfe-c570bc1b5f03 task1
 add  556a737c-11f3-4a21-a872-67e56b75cdc4 task2
Imported 2 tasks.

Por supuesto, puedes agregar cualquier atributo que desees (etiquetas, proyecto, UDA, etc.). El esquema JSON está disponible aquí:https://taskwarrior.org/docs/design/task.html

Para agregar tareas de forma masiva, primero puede crear un archivo con toda la información y luego simplemente enviarlo a task, o simplemente usar Vim contareawiki:)

información relacionada