dot

packages and services management
Log | Files | Refs | README

commit 84f1ccf2b6df91f6c5194a1bce280faff43aa3f6
parent 8f51143d78be5ccd02f241ad07d3f0f08f8c9ed6
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu, 30 Nov 2017 02:22:29 +0100

io: back to having one big list

Diffstat:
Mbin/io | 74+++++++++++++++++++++++++++++++++-----------------------------------------
1 file changed, 33 insertions(+), 41 deletions(-)

diff --git a/bin/io b/bin/io @@ -2,8 +2,25 @@ export LC_COLLATE=C -case $1 in -(f|find) +sel=$({ + abduco | sed 1d | cut -f 3 + + printf '#--- mail ---\n' + mdirs "$MAIL/.." | sort | while IFS='' read -r dir + do printf '%s\t%s\n' "$(mlist -s "$dir" | wc -l)" "${dir#$PWD/}" + done + + printf '#--- man ---\n' + IFS=: + for dir in $MANPATH + do [ $dir -nt "$HOME/.cache/man" ] && + man -k ' ' | sed -r >> "$HOME/.cache/man" \ + -e 's/ - / - /' \ + -e 's/(.{25}[^ ]* ) * - /\1- /' + done + cat "$HOME/.cache/man" + + printf '#--- files ---\n' mkdir -p "$HOME/.cache/find" find "$HOME" -maxdepth 1 -mindepth 1 | while IFS='' read -r dir do @@ -11,48 +28,23 @@ case $1 in [ "$dir" -nt "$cache" ] && find "$dir" -name .git -prune -o -print | sort -o "$cache" done - exec xdg-open "$(find "$HOME/.cache/find" -exec cat {} + | - iomenu -p find)" - ;; -(m|mblaze) - mdirs "$MAIL/.." | sort | while IFS='' read -r dir - do printf '%s\t%s\n' "$(mlist -s "$dir" | wc -l)" "${dir#$PWD/}" - done | iomenu | cut -f 2 | mlist | mthread | msort -r -d | mseq -S | - mscan -f '%6n %u %D %20f %t%2i%120S' | iomenu -p mail | + find "$HOME/.cache/find" -type f -exec cat {} + + + printf '#--- uri ---\n' + cat etc/uri +} | iomenu -#) name=${sel# } mode=${sel%% *} + +case $mode in +(*mail*) + printf %s "$name" | cut -f 2 | mlist | mthread | msort -r -d | + mseq -S | mscan -f '%6n %u %D %20f %t%2i%120S' | iomenu -p mail | sed -r 's/^ *([0-9]*) .*/\1/'| xargs mless ;; -(n|netstat) - netstat -a | sed 's/^[AP]/#&/' | iomenu -# - ;; -(p|ps) - { ps -ax || ps; } | sed '1 s/^/#/' | iomenu -p ps -# | - sed -r 's/[^ ]* *([0-9]*).*/\1/' - ;; -(s|src) - xdg-open "$(find "$2" -type f ! -path '*/.git/*' | sort | xargs -n 1 awk ' - FNR == 1 { printf("#%s\n", FILENAME); } - { printf("%7s\t%s\n", FNR, $0); } - ' | iomenu -# -p search | sed 's/ .*//')" - ;; -(m|man) - spc=' ' - exec man $(man -k ' ' | - sed -r -e "s/ - /$spc - /" -e 's/(.{25}[^ ]* ) * - /\1- /' | - iomenu -p man | +(*man*) + exec man $(printf "$name" | sed -r 's/([_a-zA-Z0-9]*).*\(([0-9p]+).*\)/\2 \1/') ;; -(a|abduco|'') - id=$(abduco | sed '1 s/^/#/' | tr ! / | iomenu -# -p abduco | - cut -f 4 | tr / !) - [ "$SSH_TTY" ] && e='^Z' || e='^\' - exec abduco -e "$e" -a "$id" - ;; -(u|uri) - exec xdg-open "$(iomenu -p uri < "$HOME/etc/uri")" - ;; -(*) - printf 'usage: io [f[ind] | m[blaze] | n[etstat] | p[s] | s[rc] path\n' - printf ' u[ri] | m[an] | a[bduco]]\n' +(*files*|'') + exec xdg-open "$name" ;; esac -