dot

packages and services management
Log | Files | Refs | README

commit 915db33f5974f32e99770b670233dccb40fa28cd
parent e194bd36100f81dde13342e62460a1db9d2cfe2d
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Fri, 11 Aug 2017 10:46:32 +0200

iomenu/bin: split io into io-cache and io

Diffstat:
Miomenu/bin/io | 69+--------------------------------------------------------------------
Riomenu/bin/io-calendar -> iomenu/bin/io-agenda | 0
Aiomenu/bin/io-cache | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 64 insertions(+), 68 deletions(-)

diff --git a/iomenu/bin/io b/iomenu/bin/io @@ -1,75 +1,8 @@ -# cache and filter find output and execute one path as argument of a script +# execute one item as argument of a program [ "$ABDUCO" != dvtm ] && [ "$ABDUCO" ] && exit 1 -# --- cache -------------------------------------------------------------------- - -mkdir -p "$HOME/var/cache" -touch "$HOME/var/cache/io" - -[ "$1" = -c ] && find "$HOME" \ - -path "*/.git/*" -prune -o \ - -path "*/.hg/*" -prune -o \ - -path "${MAIL%/*}/*/*" -prune -o \ - -type d -exec printf '%s/\n' {} + -o \ - -print 2> /dev/null | sort | - -awk -v MAIL="${MAIL%/*}" ' - - $0 ~ VAR "/irc/.*/$" { - ircv[ircc++] = $0 - } - - $0 ~ MAIL "/*/" { - mailv[mailc++] = $0 - } - - $0 ~ "/[.]git/$" || - $0 ~ "/src/[^/]*/$" && - $0 !~ "/git/.*/src/" && - $0 !~ "/src/.*/src/" { - sub("/[.]git/$", "/") - searchv[searchc++] = $0 - } - - $0 ~ VAR "/music" { - musicv[musicc++] = $0 - } - - $0 ~ ".*\\.[1-9]p?(.gz)?$" { - manv[manc++] = $0 - } - - $0 !~ "/$" { - filesv[filesc++] = $0 - } - - END { - print "# io-irc" - for (i = 0; i < ircc; i++) print(ircv[i] ) - - print "# io-mail" - for (i = 0; i < mailc; i++) print(mailv[i] ) - - print "# io-search" - for (i = 0; i < searchc; i++) print(searchv[i]) - - print "# io-music" - for (i = 0; i < musicc; i++) print(musicv[i] ) - - print "# io-man" - for (i = 0; i < manc; i++) print(manv[i] ) - - print "# " ENVIRON["EDITOR"] - for (i = 0; i < filesc; i++) print(filesv[i] ) - } - -' > "$HOME/var/cache/io" - -[ "$1" = -c ] && exit - - # --- select ------------------------------------------------------------------- selection=$({ diff --git a/iomenu/bin/io-calendar b/iomenu/bin/io-agenda diff --git a/iomenu/bin/io-cache b/iomenu/bin/io-cache @@ -0,0 +1,63 @@ +# produce a list of arguments for commands in headers, such as editor and files + +mkdir -p "$VAR/cache" +touch "$VAR/cache/io" + +find "$HOME" \ + -path "*/.git/*" -prune -o \ + -path "*/.hg/*" -prune -o \ + -path "${MAIL%/*}/*/*" -prune -o \ + -type d -exec printf '%s/\n' {} + -o \ + -print 2> /dev/null | sort | + +awk -v MAIL="${MAIL%/*}" ' + + $0 ~ ENVIRON["VAR"] "/irc/.*/$" { + ircv[ircc++] = $0 + } + + $0 ~ MAIL "/*/" { + mailv[mailc++] = $0 + } + + $0 ~ "/[.]git/$" || + $0 ~ "/src/[^/]*/$" && + $0 !~ "/git/.*/src/" && + $0 !~ "/src/.*/src/" { + sub("/[.]git/$", "/") + searchv[searchc++] = $0 + } + + $0 ~ VAR "/music" { + musicv[musicc++] = $0 + } + + $0 ~ ".*\\.[1-9]p?(.gz)?$" { + manv[manc++] = $0 + } + + $0 !~ "/$" { + filesv[filesc++] = $0 + } + + END { + print "# ii-client" + for (i = 0; i < ircc; i++) print(ircv[i] ) + + print "# io-mail" + for (i = 0; i < mailc; i++) print(mailv[i] ) + + print "# io-search" + for (i = 0; i < searchc; i++) print(searchv[i]) + + print "# io-music" + for (i = 0; i < musicc; i++) print(musicv[i] ) + + print "# mandoc -a" + for (i = 0; i < manc; i++) print(manv[i] ) + + print "# " ENVIRON["EDITOR"] + for (i = 0; i < filesc; i++) print(filesv[i] ) + } + +' > "$VAR/cache/io"