dot

packages and services management
Log | Files | Refs | README

commit 571977c6d4657ecd8c345cd19598378b52df0584
parent 5ecca62849b08130d296b903c1382c17a6e1e4e9
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat, 10 Feb 2018 10:30:53 +0100

[ref] simplified bin/io

Diffstat:
Mbin/io | 44++++++++++++++++++--------------------------
1 file changed, 18 insertions(+), 26 deletions(-)

diff --git a/bin/io b/bin/io @@ -1,42 +1,41 @@ #!/bin/sh # various interactive selection menu wrappers +export LC_COLLATE='C' + cmd="${1:-open}" [ "$#" -gt 0 ] && shift case "${cmd}" in (a|abduco) - if [ "${#}" -gt 0 ] then - name="${1}" + id="${1}" shift else - name=$({ printf '#'; abduco; } | iomenu -# | cut -f4) + id=$({ printf '#'; abduco; } | iomenu -# | cut -f4) fi [ "${SSH_TTY}" ] && e='^Z' || e='^\' - [ "${name}" ] && ABDUCO="${name}" exec abduco -e "${e}" -A "${name}" "${@}" + [ "${id}" ] && ABDUCO="${id}" exec abduco -e "${e}" -A "${id}" "${@}" ;; (f|find) find "${@:-.}" -name .git -prune -o -print | iomenu ;; (fs) { - printf '#spec .file .vfstype .mntops .freq .passno\n' | - cat - /etc/fstab | column -ts ' ' - { - printf '#device . .path . .type .mntops\n' - mount - } | column -ts ' ' - + printf '#/etc/fstab\n' + column -ts ' ' < /etc/fstab + printf '#mount\n' + mount | column -ts ' ' } | iomenu -# ;; (g|grep) - less "$(find "${1}" -name .git -prune -o -type f | sort | xargs -n 128 awk ' - FNR == 1 { printf("#%s\n", FILENAME); } - { printf("%7s\t%s\n", FNR, $0); } - ' | iomenu -# | cut -f 1)" + less "$(find "${1:-.}" -name .git -prune -o -type f | sort | + xargs -n 128 awk ' + FNR == 1 { printf("#%s\n", FILENAME); } + { printf("%7s\t%s\n", FNR, $0); } + ' | iomenu -# | cut -f 1)" ;; (l|lineart) iomenu << 'EOF' | sed 's/^[^ ]* *//' @@ -47,8 +46,6 @@ magic (∩`-´)⊃━☆゚.*・。゚ EOF ;; (m|mail) - export LC_COLLATE=C - mdirs "$HOME/.cache/mail" | sort | while IFS='' read -r dir do @@ -59,8 +56,6 @@ EOF xargs mless ;; (man) - export LC_COLLATE='C' - man -k ' ' | sed -r ' s/ - / - / s/(.{25}[^ ]* ) * - /\1- / @@ -71,8 +66,6 @@ EOF netstat -na | sed 's/^[AP]/#&/' | iomenu -# ;; (o|open) - export LC_COLLATE=C - cache="${HOME}/.cache/find" mkdir -p "${cache}" @@ -98,11 +91,10 @@ EOF ;; (pwd) { - printf '#name: pw: uid: gid: class: home_dir: shell\n' | - cat - /etc/passwd | sed 's/::/: :/g' | column -ts : - - printf '#group: pw: gid: member\n' | - cat - /etc/group | sed 's/::/: :/g' | column -ts : + printf '#/etc/passwd\n' + column -ts : < /etc/passwd + printf '#/etc/group\n' + column -ts : < /etc/group } | iomenu -# ;; (s|sfeed)