Scripts: task2org.awk convert Task Warrior data to Org-mode format.
Homeinit: using new Org-mode file.master
parent
f3d58805f0
commit
5cfc12db03
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
################################################################################
|
||||
## Home session initialization.
|
||||
## 2013-01-09
|
||||
## 2013-03-01
|
||||
################################################################################
|
||||
SOURCEDIR="${HOME}/personal/dataperso"
|
||||
[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
|
||||
|
@ -11,24 +11,21 @@ SOURCEDIR="${HOME}/personal/dataperso"
|
|||
## Emacsclient launcher. Required for best emacsclient integration. For a fully
|
||||
## functional daemon, you should write a file like this and set 'EDITOR=em'.
|
||||
if [ -f /bin/em ]; then
|
||||
echo "==> Emacs"
|
||||
echo "==> Emacs (press Ctrl-D to skip)"
|
||||
sudo sh -c "echo '#!/bin/sh
|
||||
emacsclient -a \"\" -t \"\$@\"' > '/bin/em'; chmod 755 /bin/em"
|
||||
echo
|
||||
fi
|
||||
|
||||
## Mutt
|
||||
echo "==> Mutt"
|
||||
ln -snf "$(realpath ${SOURCEDIR}/mails)" "${HOME}/.mutt"
|
||||
mkdir -p "${HOME}/.mutt.d/hcache"
|
||||
echo
|
||||
|
||||
## Taskwarrior
|
||||
echo "==> Taskwarrior"
|
||||
ln -snf "${SOURCEDIR}/todo" "${HOME}/.task"
|
||||
echo "==> TODO data"
|
||||
ln -snf "${SOURCEDIR}/todo/todo.org" "${HOME}/todo.org"
|
||||
echo
|
||||
|
||||
## rtorrent
|
||||
echo "==> rtorrent"
|
||||
mkdir -p "${HOME}/.session"
|
||||
echo
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
#!/bin/gawk -f
|
||||
## This script convert Task Warrior pending.data file to an org-mode compatible format.
|
||||
## WARNING: unpolished work. Use at your own risk!
|
||||
## TODO: check support for multiple tags.
|
||||
|
||||
BEGIN {
|
||||
FS="\" "
|
||||
|
||||
tagsep=" "
|
||||
project_empty="<none>"
|
||||
|
||||
prio_array["H"]="[#A]"
|
||||
prio_array["M"]="[#B]"
|
||||
prio_array["L"]="[#C]"
|
||||
|
||||
recur_array["yearly"]="+1y"
|
||||
recur_array["monthly"]="+1m"
|
||||
recur_array["weekly"]="+1w"
|
||||
recur_array["daily"]="+1d"
|
||||
}
|
||||
|
||||
{
|
||||
gsub(/^\[|\]$/,"")
|
||||
gsub(/:"/,":")
|
||||
|
||||
description=""
|
||||
project=project_empty
|
||||
annotation=""
|
||||
start=""
|
||||
priority=""
|
||||
recur=""
|
||||
due=""
|
||||
tags=""
|
||||
|
||||
for (i = 1; i <= NF; i++)
|
||||
{
|
||||
split($i, a, ":")
|
||||
|
||||
if (a[1] ~ "^description$")
|
||||
description=a[2] " "
|
||||
else if (a[1] ~ "^project$")
|
||||
project=a[2]
|
||||
else if (a[1] ~ "^annotation")
|
||||
annotation=annotation "\n " a[2]
|
||||
else if (a[1] ~ "^priority$")
|
||||
priority=prio_array[a[2]] " "
|
||||
else if (a[1] ~ "^tags$")
|
||||
tags=tagsep ":" a[2] ": "
|
||||
else if (a[1] ~ "^start$")
|
||||
start="TODO "
|
||||
|
||||
if (a[1] ~ "^recur$")
|
||||
recur=" " recur_array[a[2]]
|
||||
|
||||
if (a[1] ~ "^due$")
|
||||
due="<" strftime("%F",a[2])
|
||||
|
||||
delete a
|
||||
}
|
||||
|
||||
## Close 'due' after loop in case 'recur' was encountered after 'due'.
|
||||
if (due != "")
|
||||
due = due recur "> "
|
||||
|
||||
result[project]= result[project] "\n** " start priority description due tags annotation
|
||||
|
||||
}
|
||||
|
||||
function capitalize(s) {
|
||||
return toupper(substr(s,1,1)) tolower(substr(s,2))
|
||||
}
|
||||
|
||||
END {
|
||||
for ( var in result)
|
||||
printf ("\n* %s%s\n", capitalize(var), result[var])
|
||||
}
|
Loading…
Reference in New Issue