dot

packages and services management
Log | Files | Refs | README

commit 999d38cae1352a5050de6b37241ac2430b742bf9
parent dcb431a087a8a678927cac08745eb1591f6db9ce
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 28 Apr 2017 18:38:33 +0200

Layer 02

Diffstat:
M.mbsyncrc | 4++--
M.profile | 2+-
Malias | 2+-
Mbin/io | 14+++-----------
Mbin/io-abduco | 47+++++++++++++++++++++++++++++++++++++++--------
Mbin/io-mandoc | 5++++-
Mbin/mblaze-filter | 6++++--
7 files changed, 54 insertions(+), 26 deletions(-)

diff --git a/.mbsyncrc b/.mbsyncrc @@ -7,8 +7,8 @@ IMAPStore gandi-remote Account josuah.net MaildirStore gandi-local -Path ~/mail/ -Inbox ~/mail/INBOX +Path ~/var/mail/ +Inbox ~/var/mail/INBOX Channel josuah.net Master :gandi-remote: diff --git a/.profile b/.profile @@ -18,7 +18,7 @@ export OPT SRC ETC ROOT ENV="$HOME/.profile" PATH="$ETC/bin:$ROOT/sbin:$ROOT/bin:$PATH:$PLAN9/bin" MANPATH="$ETC/man:$ROOT/share/man:$ROOT/man:$MANPATH" -MAIL="$HOME/mail/INBOX" +MAIL="$HOME/var/mail/INBOX" export ENV PATH MANPATH MAIL diff --git a/alias b/alias @@ -5,7 +5,7 @@ alias cl='printf "\033[H\033[2J"' alias ..='cd ..' # iomenu -alias v='io-edit' +alias v='io-abduco' alias a='io-abduco' alias r='io-run' alias j='fg "%$(jobs | iomenu | sed -r "s/.([0-9]*).*/\1/")"' diff --git a/bin/io b/bin/io @@ -4,8 +4,6 @@ CACHE="$HOME/.cache/io" - - line="$(while IFS='' read -r line do if [ "$line" ] && [ -z "${line%%# *}" ] @@ -33,15 +31,9 @@ do fi done << EOF | iomenu -s -h -p io | sed 's/# //' -# io-abduco -$(abduco | tail -n +2) - -# mandoc -a # -type f -name *.[1-9] +# mandoc -a # -type f -name *.[1-9] -o -name *.[1-9].gz $(printf %s "$MANPATH" | sed 's/:/\n/g') - -# exec # -type f -$HOME/etc - +/usr/share/man EOF )" @@ -49,4 +41,4 @@ command="${line%% *}" path="${line#* }" printf '%s\n' "$command" "$path" -exec $command "$path" +[ "$command" ] && [ "$path" ] && exec $command "$path" diff --git a/bin/io-abduco b/bin/io-abduco @@ -1,13 +1,44 @@ # Attach to an abduco session -name="${1##* }" -if [ "$ABDUCO" ] -then - printf 'session already active: %s\n' "$ABDUCO" - exit 1 -fi +CACHE="${XDG_CACHE_HOME:-$HOME/.cache}" -printf '\033[H\033[J' # clear the screen +[ "$ABDUCO" ] && exit 1 -[ "$name" ] && ABDUCO="$name" exec abduco -a "$name" +mkdir -p "$CACHE/io" +touch "$CACHE/io/files" + + +# --- prompt ------------------------------------------------------------------- + +file="$({ + printf '# ' + abduco | sed 's/.*\t//; s|!|/|g' + + printf '# Recent files\n' + tac "$CACHE/io/files" + + printf '# All files\n' + find "$HOME" -type f ! -path '*/.git/*' +} | iomenu -s -p io | tee -a "$CACHE/io/files")" + +name="$(printf %s "$file" | sed 's|/|!|g')" + + +# --- history ------------------------------------------------------------------ + +sort "$CACHE/io/files" | uniq -d | while IFS='' read -r path +do + printf '%s\n' "$( + grep -Fxv "$path" "$CACHE/io/files" + )" "$path" > "$CACHE/io/files" +done + +printf '%s\n' "$(tail "$CACHE/io/files")" > "$CACHE/io/files" + + +# --- attach ------------------------------------------------------------------- + +printf '\033[H\033[2J' + +[ "$name" ] && ABDUCO="$name" exec abduco -A "$name" $EDITOR "$file" diff --git a/bin/io-mandoc b/bin/io-mandoc @@ -2,5 +2,8 @@ mandoc -a "$( IFS=':' - find $MANPATH ! -type d -name '*.[0-9]' | sort -u | iomenu -p mandoc -l 255 + find $MANPATH /usr/share/man ! -type d \ + -name '*.[0-9]' -o -name '*.[0-9].gz' | + sort -u | + iomenu -p mandoc -l 255 )" diff --git a/bin/mblaze-filter b/bin/mblaze-filter @@ -5,8 +5,10 @@ filter() { mlist "$MAIL" | magrep "$1" | while IFS='' read -r mail do - mkdir -p "${MAIL%/*}/$2/{cur,new,tmp}" - mv "$mail" "${MAIL%/*}/$2/cur" + mkdir -p "${MAIL%/*}/$2/cur" + mkdir -p "${MAIL%/*}/$2/new" + mkdir -p "${MAIL%/*}/$2/tmp" + mv "$mail" "${MAIL%/*}/$2/new" done }