[PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch::
From: David BremnerIn this initial version, we take care of only the base import and export of the appropriate tags in line oriented format amenable to easy merging. The current plan to use git to share tags and resolve conflicts. --- contrib/nmbug | 69 + 1 files changed, 69 insertions(+), 0 deletions(-) create mode 100755 contrib/nmbug diff --git a/contrib/nmbug b/contrib/nmbug new file mode 100755 index 000..e9d1b14 --- /dev/null +++ b/contrib/nmbug @@ -0,0 +1,69 @@ +#!/bin/bash +# Copyright (c) 2011 David Bremner +# License: same as notmuch + +NMHOME=${HOME}/.nmbug + +NMTAGS=($(notmuch search --output=tags "*"|grep "^notmuch::")) + +function dump() { +notmuch dump -- $(printf " tag:%s" ${NMTAGS[*]}) |\ +while read -r msgid rest +do + outfile=$NMHOME/tags/$(echo $msgid | sha1sum - | cut -f1 -d' ') + echo $outfile + printf "msg-id: %s\n" $msgid > $outfile + tmp=${rest#\(} + read -r -a tags <<<${tmp%\)}; + for tag in "${tags[@]}"; do + case $tag in + notmuch::*) + echo "tag: $tag" >> $outfile + ;; + *) + # nothing + esac + done +done + +} + +function cat_file() { +tags="" +id="" +cat $1 |\ +while read -r what data +do + case $what in + msg-id:) + printf "%s (" $data + ;; + tag:) + printf "%s " $data + ;; + *) + echo "Syntax error $what" + exit 1 + esac +done +echo ")" +} + +function restore() { +find $NMHOME/tags -type f |\ +while read -r filename +do + cat_file $filename +done | notmuch restore --match=notmuch:: +} +case $1 in +dump) + dump + ;; +restore) + restore + ;; +*) + echo unknown command $1; +esac + -- 1.7.6.3
[PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch::
From: David Bremner brem...@debian.org In this initial version, we take care of only the base import and export of the appropriate tags in line oriented format amenable to easy merging. The current plan to use git to share tags and resolve conflicts. --- contrib/nmbug | 69 + 1 files changed, 69 insertions(+), 0 deletions(-) create mode 100755 contrib/nmbug diff --git a/contrib/nmbug b/contrib/nmbug new file mode 100755 index 000..e9d1b14 --- /dev/null +++ b/contrib/nmbug @@ -0,0 +1,69 @@ +#!/bin/bash +# Copyright (c) 2011 David Bremner +# License: same as notmuch + +NMHOME=${HOME}/.nmbug + +NMTAGS=($(notmuch search --output=tags *|grep ^notmuch::)) + +function dump() { +notmuch dump -- $(printf tag:%s ${NMTAGS[*]}) |\ +while read -r msgid rest +do + outfile=$NMHOME/tags/$(echo $msgid | sha1sum - | cut -f1 -d' ') + echo $outfile + printf msg-id: %s\n $msgid $outfile + tmp=${rest#\(} + read -r -a tags ${tmp%\)}; + for tag in ${tags[@]}; do + case $tag in + notmuch::*) + echo tag: $tag $outfile + ;; + *) + # nothing + esac + done +done + +} + +function cat_file() { +tags= +id= +cat $1 |\ +while read -r what data +do + case $what in + msg-id:) + printf %s ( $data + ;; + tag:) + printf %s $data + ;; + *) + echo Syntax error $what + exit 1 + esac +done +echo ) +} + +function restore() { +find $NMHOME/tags -type f |\ +while read -r filename +do + cat_file $filename +done | notmuch restore --match=notmuch:: +} +case $1 in +dump) + dump + ;; +restore) + restore + ;; +*) + echo unknown command $1; +esac + -- 1.7.6.3 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch::
On Sat, Oct 29, 2011 at 01:45:07PM -0300, David Bremner wrote: From: David Bremner brem...@debian.org In this initial version, we take care of only the base import and export of the appropriate tags in line oriented format amenable to easy merging. The current plan to use git to share tags and resolve conflicts. --- contrib/nmbug | 69 + 1 files changed, 69 insertions(+), 0 deletions(-) create mode 100755 contrib/nmbug diff --git a/contrib/nmbug b/contrib/nmbug new file mode 100755 index 000..e9d1b14 --- /dev/null +++ b/contrib/nmbug @@ -0,0 +1,69 @@ +#!/bin/bash ^^ I'd make that: #!/usr/bin/env bash for systems where bash is not the default shell. +# Copyright (c) 2011 David Bremner +# License: same as notmuch + +NMHOME=${HOME}/.nmbug + +NMTAGS=($(notmuch search --output=tags *|grep ^notmuch::)) + +function dump() { +notmuch dump -- $(printf tag:%s ${NMTAGS[*]}) |\ +while read -r msgid rest +do + outfile=$NMHOME/tags/$(echo $msgid | sha1sum - | cut -f1 -d' ') + echo $outfile + printf msg-id: %s\n $msgid $outfile + tmp=${rest#\(} + read -r -a tags ${tmp%\)}; + for tag in ${tags[@]}; do + case $tag in + notmuch::*) + echo tag: $tag $outfile + ;; + *) + # nothing + esac + done +done + +} + +function cat_file() { +tags= +id= +cat $1 |\ +while read -r what data +do + case $what in + msg-id:) + printf %s ( $data + ;; + tag:) + printf %s $data + ;; + *) + echo Syntax error $what + exit 1 + esac +done +echo ) +} + +function restore() { +find $NMHOME/tags -type f |\ +while read -r filename +do + cat_file $filename +done | notmuch restore --match=notmuch:: +} +case $1 in +dump) + dump + ;; +restore) + restore + ;; +*) + echo unknown command $1; +esac + -- 1.7.6.3 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch pgpRivR7vRz02.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch::
On Sun, 30 Oct 2011 00:11:35 +0300, Ali Polatel pola...@gmail.com wrote: ^^ I'd make that: #!/usr/bin/env bash for systems where bash is not the default shell. OK, I'll do that in the next version. I always forget about those people who install bash in funny places. d ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch::
On Sat, Oct 29, 2011 at 07:12:52PM -0300, David Bremner wrote: On Sun, 30 Oct 2011 00:11:35 +0300, Ali Polatel pola...@gmail.com wrote: ^^ I'd make that: #!/usr/bin/env bash for systems where bash is not the default shell. OK, I'll do that in the next version. I always forget about those people who install bash in funny places. Cool! Just to note, it's the standards, not the people, which are funny... d -alip pgpvandoqzlIl.pgp Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch