iomenu

interactive text selection menu
Log | Files | Refs | README | LICENSE

commit 816338aa8b123757fec090970e98d92edb2be376
parent d0e21509afe9e6ebf8e3f0e75ce31d9799905c7a
Author: Josuah Demangeonā  ā µ <mail@josuah.net>
Date:   Sat, 11 Mar 2017 11:19:11 +0100

removed the scripts

Diffstat:
Dio-abduco | 15---------------
Dio-files | 58----------------------------------------------------------
Dio-grep | 16----------------
Dio-man | 9---------
Dio-mblaze | 16----------------
Dio-run | 100-------------------------------------------------------------------------------
Dio-setfont | 11-----------
7 files changed, 0 insertions(+), 225 deletions(-)

diff --git a/io-abduco b/io-abduco @@ -1,15 +0,0 @@ -# Prompt for an abduco session to attach to - -if [ "$ABDUCO" ] -then - printf 'session already active: %s\n' "$ABDUCO" - exit 1 -fi - -name="$(printf '#%s' "$( - abduco | sed -r 's/(.*)\t(.*)/\2 # \1/' -)" | iomenu -s '#')" - -[ "$SSH_CLIENT$SSH_TTY$SSH_CONNECTION" ] && e='^\' || e='^Z' - -TERM=screen ABDUCO="$name" exec abduco -e "$e" -A "$name" "$SHELL" diff --git a/io-files b/io-files @@ -1,58 +0,0 @@ -# Prompt a file to open in PAGER, with an history. In less(1), 'v' to edit. - - -CACHE="${XDG_CACHE_HOME:-$HOME/.cache}" - - -path() -( - if [ "$1" ] - then - printf '%s\n' "$(cd "${1%/*}"; pwd)/${1##*/}" - else - { - printf '#\n# Recent files\n' - [ -f "$CACHE/iomenu/files" ] && - tac "$CACHE/iomenu/files" - - printf '#\n# Current directory\n' - find "$PWD" -maxdepth 1 -type f - - printf '#\n# All files\n' - find ~ -type f ! -path '*/.cache/*' ! -path '*/.git/*' - - } | sed "s|$HOME|~|" | iomenu -l 256 -s '#' | sed "s|~|$HOME|" - - fi | tee -a "$CACHE/iomenu/files" -) - - -history() -( - sort "$CACHE/iomenu/files" | uniq -d | while IFS='' read -r f - do - printf '%s\n' "$( - grep -Fxv "$f" "$CACHE/iomenu/files" - )" "$f" > "$CACHE/iomenu/files" - done - - printf '%s\n' "$(tail "$CACHE/iomenu/files")" > "$CACHE/iomenu/files" -) - - -main() -( - mkdir -p "$CACHE/iomenu" - - file="$(path "$1")" - - # terminal name - printf '\033]0;%s\007' "$(printf %s "$file" | sed "s|$HOME|~|")" - - history - - [ "$file" ] && [ -d "${file%/*}" ] && exec $EDITOR "$file" -) - - -main "$@" diff --git a/io-grep b/io-grep @@ -1,16 +0,0 @@ -directory="$( - cd "$HOME" - find . -type d ! -path '*/.git/*' ! -name '.git' | - sed 's/^./~/' | iomenu -l 256 -)" - -directory="$HOME${directory#\~}" - -grep -rL '\x00' "$directory" | while IFS='' read -r path -do - printf '#io-grep %s\n' "~${path#$HOME}" - cat "$path" -done | iomenu -s '#io-grep' -H -N -l 256 | { - IFS=' ' read -r path line - exec $EDITOR +"$line"g "$HOME${path#\~}" -} diff --git a/io-man b/io-man @@ -1,9 +0,0 @@ -# prompt a man page to open - -man "$( - IFS=':' - find $(manpath -q) ! -type d | - sed -r 's/.*\/(.*).[0-9](.gz)?$/\1/' | - sort -u | - iomenu -)" diff --git a/io-mblaze b/io-mblaze @@ -1,16 +0,0 @@ -T=' ' -choice="$( - mdirs "${MAIL%/*}" | while IFS='' read -r dir - do - printf '#\n# %s\n' "${dir##*/}" - - mlist "$dir" | mpick :u | msort -d | mthread | - mscan -f '%D %24f %u%t%2i%120S' - - done | iomenu -N -H -s '#' -l 255 -)" - -[ "$choice" ] || exit 0 - -mlist "${MAIL%/*}/${choice%%$T*}" | mpick :u | msort -d | mthread | -sed -n "${choice#*$T}p" | mshow | $PAGER diff --git a/io-run b/io-run @@ -1,100 +0,0 @@ -# Prompt for a programs to run - - -CACHE="${XDG_CACHE_HOME:-$HOME/.cache}" - - -usage() -{ - printf 'Usage: %s [cmd [args...] [+]] - -cmd do not prompt for a command and run cmd right away -args do not prompt for arguments neither and use arg -+ if present after the arguments, prompt for a path\n' "${0##*/}" -} - - -# -# Update the cache and get the command to run. -# -update_cache() -( - IFS=':' u=0 - - for dir in $PATH - do - [ "$CACHE/dmenu_run" -ot "$dir" ] && u=1 - done - - [ "$u" -eq 1 ] && find -L $PATH -type f -exec test -x {} \; -print | - sed 's|.*/||' | sort -u > "$CACHE/dmenu_run" -) - - -# -# Prompt for options for a given command and log it to an history file -# -get_options() -( - local command="$1" - - printf '%s ' "$command" >> "$CACHE/iomenu/run" - - while read -r cmd opt - do - [ "$command" = "$cmd" ] && printf '%s\n' "$opt" - done < "$CACHE/iomenu/run" | - iomenu -p "$command" | tee -a "$CACHE/iomenu/run" - - sort -u "$CACHE/iomenu/run" -o "$CACHE/iomenu/run" -) - - -# -# Prompt for a file path in $HOME and print it. -# -get_path() -( - find "$HOME" ! -path "$CACHE" ! -path '*/.git/*' | - sed -r "s/.{${#HOME}}/~/" | iomenu -l 256 | sed 's/^~//' -) - - -# -# Get the options according to the command and run it -# -run() -( - command="${1:-$(iomenu -l 256 -s '#' < "$CACHE/dmenu_run")}" - - [ -z "$command" ] && exit 1 - - options="$(get_options "$command")" - - if [ "$options" ] && [ -z "${options%%*+}" ] - then - path="$(get_path)" options="${options%+}" - fi - - if [ "$path" ] - then exec $command $options "$path" - else exec $command $options - fi -) - - -main() -( - mkdir -p "$CACHE/iomenu" - - if [ $# -gt 0 ] && [ -z "${1##-*}" ] - then - usage - else - update_cache - run "$@" - fi -) - - -main "$@" diff --git a/io-setfont b/io-setfont @@ -1,11 +0,0 @@ -setfont "$( - find /usr/share ~ -type d -name consolefonts | while IFS='' read -r path - do - cd "$path" || exit 1 - - fonts="$(find . -type f | cut -c 3-)" - - [ "$fonts" ] && printf '#\n# %s\n%s\n' "$path" "$fonts" - - done | iomenu -l 256 -s '#' -H | sed 's/\t/\//' -)"