dot

packages and services management
Log | Files | Refs | README

commit 452980f9266205fdd64f9ce5b78402e144f8cde9
parent 9c1ca10ec3d660929dd249c06a8f7e3ab872f875
Author: sshbio <jd@ssh.bio>
Date:   Sat, 23 Jul 2016 19:29:37 +0200

Improved prompt

Diffstat:
Damath/build.sh | 3---
Dbin/armv7l/abduco | 0
Mbin/feeds | 7+++----
Mbin/src | 2+-
Mbin/www | 85++++++++++++++++++++++++++-----------------------------------------------------
Dbin/x86_64/abduco | 0
Dbin/x86_64/dvtm | 0
Dbin/x86_64/dvtm-status | 16----------------
Dbin/x86_64/icat | 0
Dbin/x86_64/mbsync | 0
Dbin/x86_64/s-nail | 0
Dbin/x86_64/vis | 0
Dbin/x86_64/vis-clipboard | 104-------------------------------------------------------------------------------
Dbin/x86_64/vis-menu | 0
Dbin/x86_64/vis-open | 38--------------------------------------
Ryacc/build.sh -> byacc/build.sh | 0
Mdoc/todo | 4+++-
Minstall.sh | 1+
Dlex/build.sh | 3---
Ammh/build.sh | 4++++
Areflex/build.sh | 10++++++++++
Ms-nail/.mailrc | 130+++++++++++++++++++++++++++++++++++--------------------------------------------
Ms-nail/build.sh | 11+++++++++--
Mshell/.profile | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
24 files changed, 198 insertions(+), 331 deletions(-)

diff --git a/amath/build.sh b/amath/build.sh @@ -1,3 +0,0 @@ -# Convert ASCII math notation to MathML - -tar=http://github.com/camoy/amath/archive/master.tar.gz diff --git a/bin/armv7l/abduco b/bin/armv7l/abduco Binary files differ. diff --git a/bin/feeds b/bin/feeds @@ -58,15 +58,14 @@ BEGIN{ } c3[l] = $NF; # Last column - + max1 = ((length(c1[l]) > max1) ? length(c1[l]) : max1); max2 = ((length(c2[l]) > max2) ? length(c2[l]) : max2); } END { - for (i = 1; i <= l; i++) - { - printf("%-"max1"s %-"max2"s %s\n", c1[i], c2[i], c3[i]); + for (i = 1; i <= l; i++) { + printf("%-"max1"s %-"max2"s %s\n", c1[i], c2[i], c3[i]); } }' diff --git a/bin/src b/bin/src @@ -133,7 +133,7 @@ do build() # Default build function { - for patch in $(find "$DOT/src/$1" -name '*.diff') + for patch in $(find "$DOT/$1" -name '*.diff') do patch -p1 < "$patch" done diff --git a/bin/www b/bin/www @@ -6,93 +6,64 @@ # \____/ \____/ \____/ - Static website generator #=============================================================================== -SITE=".site" +OUT=".site" LAYOUT="layout.html" -CONVERTER='smu' -EXT='md' NL=' ' parse() { - local item="$1" path="$1" input="$2" nav="$3" + local item="$1" input="$2" nav="$3" - - [ -d "$item" ] && path="$path/index" - - # :::{{... printf %s "${input%%{{*}" - # Check for remaining keywords. - [ "${input##*{{*}" ] && return 0 + [ "${input##*{{*}" ] && return 0 # Check for remaining keywords. - # ...{{::: input="${input#*{{}" - # :::}}... - local keyword="${input%%\}\}*}" - [ "$keyword" ] || return 0 - keyword="${keyword# }" - keyword="${keyword% }" - - # ...}}::: - input="${input#*\}\}}" - # Execute the keyword and print its output. - case "$keyword" in - content ) [ -f "$path" ] && $CONVERTER "$path" ;; - list ) list "$item" ;; - nav ) parse "$item" "$nav" ;; - root ) printf %s "$path" | sed 's/[^/]//g; s/\//..\//g; s/$/./' ;; - title ) printf %s "$item" | sed 's/\// > /g' ;; + case "${input%%\}\}*}" in + *content* ) [ -f "$item/INDEX" ] && cat "$item/INDEX" ;; + *list* ) list "$item" ;; + *nav* ) parse "$item" "$nav" ;; + *root* ) printf %s "$item/" | sed 's/[^/]//g; s/\//..\//g; s/$/./' ;; + *title* ) printf %s "$item" | sed 's/\// > /g' ;; esac - parse "$item" "$input" "$nav" + parse "$item" "${input#*\}\}}" "$nav" } list() { - local item="$1" - local stat format='<a href="%s">%-30s</a> %s\n' + local IFS="$NL" stat format='<a href="%s">%-30s</a> %s\n' - printf '<b>%-30s %-13s %-10s</b>\n'"$format" NAME SIZE EDIT '..' '..' - if [ -d "$item" ] - then - IFS="$NL" - for path in $(ls "$item") - do - stat="$(stat -c '%-13b %-10z' "$item/$path")" - stat="${stat%:*}" - [ -z "${path%%*$EXT}" ] && path="${path%$EXT}html" - printf "$format" "$path" "$path" "${stat% *}" - done - unset IFS - fi + printf '<b>%-30s %-13s %-10s</b>\n' NAME SIZE EDIT + for path in $(find "$1" -mindepth 1 -maxdepth 1 ! -name 'INDEX') + do + stat="$(stat -c '%-13b %-10y' "$path")" stat="${stat%:*}" + printf "$format" "${path#$1/}" "${path#$1/}" "${stat% *}" + done + unset IFS } # Generate navigation -IFS="$NL" +IFS="$NL" nav='<a href="..">&lt;&lt;&lt;</a>' for dir in $(find . -mindepth 1 -maxdepth 1 -type d ! -path '*/.*') -do nav="$nav - <a href=\"{{ root }}/${dir#./}\">${dir#./}</a>" +do nav="$nav$NL<a href=\"{{ root }}/${dir#./}\">${dir#./}</a> |" done unset IFS -nav="<ul>$nav$NL</ul>$NL" +nav="${nav% |}" -# Create directory structure, add the directory index, copy static files, convert other files -mkdir "$SITE" -find . -mindepth 1 ! -path '*/.*' ! -name 'index' | while read path +# Create pages from directory structure, copy static files +mkdir -p "$OUT" +rm -r "$OUT"/* +find . -mindepth 1 ! -path '*/.*' ! -name 'INDEX' | while read path do path="${path#./}" if [ -d "$path" ] then - mkdir -p "$SITE/$path" - parse "$path" "$(tee < "$LAYOUT")" "$nav" \ - > "$SITE/$path/index.html" - elif [ -z "${path##*.$EXT}" ] - then - parse "$path" "$(tee < "$LAYOUT")" "$nav" \ - > "$SITE/${path%$EXT}html" + mkdir -p "$OUT/$path" + parse "$path" "$(cat "$LAYOUT")" "$nav" > "$OUT/$path/index.html" else - cp "$path" "$SITE/$path" + cp "$path" "$OUT/$path" fi done diff --git a/bin/x86_64/abduco b/bin/x86_64/abduco Binary files differ. diff --git a/bin/x86_64/dvtm b/bin/x86_64/dvtm Binary files differ. diff --git a/bin/x86_64/dvtm-status b/bin/x86_64/dvtm-status @@ -1,16 +0,0 @@ -#!/bin/sh - -FIFO="/tmp/dvtm-status.$$" - -[ -p "$FIFO" ] || mkfifo -m 600 "$FIFO" || exit 1 - -while true; do - printf '%s\n' "$(date +'%d/%m/%y %H:%M')" - sleep 30 -done > "$FIFO" & - -STATUS_PID=$! -dvtm -s "$FIFO" "$@" 2> /dev/null -kill $STATUS_PID -wait $STATUS_PID 2> /dev/null -rm -f "$FIFO" diff --git a/bin/x86_64/icat b/bin/x86_64/icat Binary files differ. diff --git a/bin/x86_64/mbsync b/bin/x86_64/mbsync Binary files differ. diff --git a/bin/x86_64/s-nail b/bin/x86_64/s-nail Binary files differ. diff --git a/bin/x86_64/vis b/bin/x86_64/vis Binary files differ. diff --git a/bin/x86_64/vis-clipboard b/bin/x86_64/vis-clipboard @@ -1,104 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2016 Richard Burke, ISC licensed - -vc_fatal() { - echo "$@" >&2 - exit 1 -} - -vc_usage() { - vc_fatal "`basename $0` [--usable|--copy|--paste]" -} - -vc_determine_command() { - if [ -n "$DISPLAY" ]; then - for c in xclip xsel; do - if type "$c" >/dev/null 2>&1; then - echo "$c" - return 0 - fi - done - elif type pbcopy >/dev/null 2>&1; then - echo 'mac' - return 0 - elif [ -c /dev/clipboard ]; then - echo 'cygwin' - return 0 - fi - - return 1 -} - -vc_usable() { - if vc_determine_command >/dev/null 2>&1; then - exit 0 - fi - - exit 1 -} - -vc_copy() { - COPY_CMD="`vc_determine_command 2>/dev/null`" - - if [ $? -ne 0 ] || [ -z "$COPY_CMD" ]; then - vc_fatal 'System clipboard not supported' - fi - - vc_${COPY_CMD}_copy - - exit $? -} - -vc_paste() { - PASTE_CMD="`vc_determine_command 2>/dev/null`" - - if [ $? -ne 0 ] || [ -z "$PASTE_CMD" ]; then - vc_fatal 'System clipboard not supported' - fi - - vc_${PASTE_CMD}_paste - - exit $? -} - -vc_xsel_copy() { - xsel -bi -} - -vc_xsel_paste() { - xsel -bo -} - -vc_xclip_copy() { - xclip -selection clipboard -i >/dev/null 2>&1 -} - -vc_xclip_paste() { - xclip -selection clipboard -o -} - -vc_mac_copy() { - pbcopy -} - -vc_mac_paste() { - pbpaste -} - -vc_cygwin_copy() { - cat >/dev/clipboard -} - -vc_cygwin_paste() { - cat /dev/clipboard -} - -case "$1" in - --usable) vc_usable;; - --copy) vc_copy;; - --paste) vc_paste;; - *) ;; -esac - -vc_usage diff --git a/bin/x86_64/vis-menu b/bin/x86_64/vis-menu Binary files differ. diff --git a/bin/x86_64/vis-open b/bin/x86_64/vis-open @@ -1,38 +0,0 @@ -#!/bin/sh - -PATTERN="." -VIS_MENU_ARGS="-b" - -while [ $# -gt 0 ]; do - case "$1" in - -h|--help) - echo "usage: $(basename $0) [-h] [-p prompt] [file-pattern]" - exit 0; - ;; - -p) - VIS_MENU_ARGS="$VIS_MENU_ARGS -p $2" - shift - shift - ;; - *) - PATTERN=$* - break - ;; - esac -done - -DIR="" -[ ! -z "$PATTERN" -a "$PATTERN" != "." -a -d "$PATTERN" ] && DIR="$PATTERN" - -while true; do - SEL=$({ echo ..; ls -1 $PATTERN 2>/dev/null || echo $PATTERN; } | vis-menu $VIS_MENU_ARGS) - [ -z "$SEL" ] && exit 1 - [ ! -z "$DIR" ] && SEL="$DIR/$SEL" - if [ -d "$SEL" ]; then - DIR="$SEL" - PATTERN="$DIR" - else - echo "$SEL" - exit 0 - fi -done diff --git a/yacc/build.sh b/byacc/build.sh diff --git a/doc/todo b/doc/todo @@ -3,6 +3,8 @@ vis-menu: propose to choose 'select and exit' key other than enter, for in-buffe vis-menu: add support for n static header line fix vis-menu shifting with abduco output (same happen with slmenu) vis: add a very basic fmt function to refill text -profile: error code in full width before prompt if return value is not 0 src: learn how to build with local libraries (CPATH...) vis: delete spaces alone in a line after inserting newline. +vis: auto-insert templates while creating new files +vis-menu integration with the shell, with more while command goes above the bottom of the screen. +vis-menu and completion: on CTRL + N, start vis-menu right under the cursor. diff --git a/install.sh b/install.sh @@ -19,6 +19,7 @@ case "$1" in done ;; -m) + mkdir "$HOME/Mail" printf 'password: '; read password printf 'machine %s\nlogin %s\npassword %s' "$host" "$mail" "$password" \ > "$HOME/.netrc" diff --git a/lex/build.sh b/lex/build.sh @@ -1,2 +0,0 @@ -# lex implementation -tar=http://invisible-island.net/datafiles/release/reflex.tar.gz- \ No newline at end of file diff --git a/mmh/build.sh b/mmh/build.sh @@ -0,0 +1,4 @@ +# Meillo's Mail Handler, a modern nmh implementation + +tar=http://marmaro.de/prog/mmh/files/mmh-0.2.tar.gz + diff --git a/reflex/build.sh b/reflex/build.sh @@ -0,0 +1,10 @@ +# lex implementation +tar=http://invisible-island.net/datafiles/release/reflex.tar.gz + +build() +{ + ./configure --prefix="$PREFIX" + make + make install + ln -s reflex ../bin/flex +} diff --git a/s-nail/.mailrc b/s-nail/.mailrc @@ -1,105 +1,80 @@ -set sendmail="~/.local/bin/msmtp" +# __ /\ +# ____ ____ _____ \/ / / +# / __/___ / __ \ .'__ / /\ / / +# __\ \//__// / / // /_/ / / // / +# \___/ \/ \/ \____/ \/ \/ - .mailrc - s-nail configuration file +#=============================================================================== -#@ mail.rc -#@ Configuration file for Mail(1) v14.8.8 -# S-nail(1): v14.8.8 / 2016-03-26 - -# The standard POSIX 2008/Cor 1-2013 mandates the following initial settings: -# (Keep in sync: ./main.c:_startup(), ./nail.rc, ./nail.1:"Initial settings"!) -# [a] noallnet, noappend, asksub, noaskbcc, noaskcc, noautoprint, -# [b-e] nobang, nocmd, nocrt, nodebug, nodot, escape="~", -# [f-i] noflipr, nofolder, header, nohold, noignore, noignoreeof, -# [j-o] nokeep, nokeepsave, nometoo, nooutfolder, -# [p-r] nopage, prompt="? ", noquiet, norecord, -# [s] save, nosendwait, noshowto, nosign, noSign, -# [t-z] toplines="5" -# Notes: -# - no*onehop* doesn't exist in this implementation. -# (To pass options through to an MTA, either add them after a "--" separator -# on the command line or by setting the *sendmail-arguments* variable.) -# - *prompt* is "\\& " by default, which will act POSIX-compliant -# unless the user would set *bsdcompat* - -## The remaining content adjusts the standard-imposed default settings. -# Note that some of the following flags are specific to S-nail(1) and may thus -# not work with other Mail(1) / mailx(1) programs. -# Entries are marked [OPTION] if their availability is compile-time dependent - -#===[ VARIABLES ]=============================================================== +set sendmail="~/.local/bin/msmtp" -# Enter threaded mode automatically -set autosort=thread +# Assume a CRT-like terminal and invoke a $PAGER +set crt +set colour-pager -# Scroll to the lastest message -set showlast +# Startup into interactive mode even if the (given) mailbox is empty +set emptystart -# If threaded mode is activated, automatically collapse thread -#set autocollapse +# Do not save message to mbox +set hold +set keepsave -# Ask for a message subject. -set ask -# *bsdannounce* prints a header summary on folder change and thus complements -# *header* on a per-folder basis (it is meaningless unless *header* is set) -set bsdannounce +# COMPOSING +#------------------------------------------------------------------------------- -# Uncomment this in order to get coloured output in $PAGER. -# (Coloured output is only used if $TERM is either found in *colour-terms* -# or includes the string "color") -set colour-pager +# Automatically quote the text of the message that is responded to. +set quote -# Assume a CRT-like terminal and invoke a $PAGER -set crt +# Quote the original message in replies by "> " as usual on the Internet +set indentprefix="> " -# Define date display in header summary -set datefield="%R %m-%d" datefield-markout-older=" %g-%m-%d" +# When replying to or forwarding a message the comment and name parts of email +# addresses are removed unless this variable is set. +set fullnames # When composing messages a line consisting of `.' finalizes a message set dot -# Immediately start $EDITOR (or $VISUAL) when composing a message -set editalong - -# Startup into interactive mode even if the (given) mailbox is empty -set emptystart - -# When replying to or forwarding a message the comment and name parts of email -# addresses are removed unless this variable is set. -set fullnames +# Ask for a message subject. +set ask -# [OPTION] Add more entries to the history as is done by default -set history-gabby +# Define date display in header summary +set datefield="%R %m-%d" datefield-markout-older=" %g-%m-%d" -# Do not forward to mbox by default -set hold +# Immediately start $EDITOR (or $VISUAL) when composing a message +set editalong -# Do not move `save'd or `write'n message to mbox by default -set keepsave -# Quote the original message in replies by "> " as usual on the Internet -set indentprefix="> " +# HEADLINE +#------------------------------------------------------------------------------- # Mark messages that have been answered set markanswered +# Prints a header summary on folder change and thus complements +set header +set bsdannounce + # Try to circumvent false or missing MIME Content-Type descriptions. set mime-counter-evidence +# Enter threaded mode automatically +set autosort=thread + +# Scroll to the lastest message +set showlast + +set headline="%>%a %m %-f %11d %i%-s" + # A nice prompt for ISO 6429/ECMA-48 terminals. #set prompt="\033[1m\?\$ \@>\033[0m " -# Automatically quote the text of the message that is responded to. -set quote - # On group replies, specify only the sender of the original mail in To: and # mention it's other recipients in the secondary Cc: instead of placing them # all together in To: set recipients-in-cc -# When responding to a message, try to answer in the same character set -set reply-in-same-charset - -# [OPTION] Outgoing messages are sent in UTF-8 if possible, otherwise LATIN1. +# Outgoing messages are sent in UTF-8 if possible, otherwise LATIN1. set sendcharsets=utf-8,iso-8859-1 # When sending a message wait until the MTA (including the builtin SMTP one) @@ -112,7 +87,9 @@ set showname # Show recipients of messages sent by the user himself in header summaries set showto -#===[ COMMANDS ]================================================================ + +# COMMANDS +#------------------------------------------------------------------------------- # Only include these selected header fields when forwarding messages fwdretain subject date from to @@ -120,7 +97,9 @@ fwdretain subject date from to # Only include the selected header fields when printing messages retain date from to cc subject message-id mail-followup-to reply-to -#===[ PIPE-TYPE/SUBTYPE ]======================================================= + +# PIPE-TYPE/SUBTYPE +#------------------------------------------------------------------------------- # HTML as text, inline display via retawq(1) set pipe-text/html="cat > \"${TMPDIR}/${NAIL_FILENAME_GENERATED}\"; \ @@ -135,3 +114,10 @@ set pipe-application/pdf="cat > \"${TMPDIR}/${NAIL_FILENAME_GENERATED}\"; \ DISPLAY=':0' mupdf-x11 \"${TMPDIR}/${NAIL_FILENAME_GENERATED}\"" # s-it-mode + + +# COMMANDS +#------------------------------------------------------------------------------- + +# If threaded mode is activated, automatically collapse thread +#uncollapse diff --git a/s-nail/build.sh b/s-nail/build.sh @@ -1,3 +1,9 @@ -# Mailx implementation +# Clean MailX implementation -tar=http://www.sdaoden.eu/downloads/s-nail-14.8.8.tar.gz +tar=http://www.sdaoden.eu/downloads/s-nail-latest.tar.gz + +build() +{ + make config + make PREFIX="$PREFIX" install +}+ \ No newline at end of file diff --git a/shell/.profile b/shell/.profile @@ -7,7 +7,7 @@ #=\/============================================================================ export EMAIL='jd@ssh.bio' -export LS_COLORS='so=35:tw=91:ow=93' +export LS_COLORS='so=35:tw=91:ow=93' export NCURSES_NO_UTF8_ACS=1 # Fix for dvtm + abduco in TTY #===[ COMMANDS ]=== @@ -32,16 +32,7 @@ export PATH="$PATH:$DOT/bin/$(uname -m)" # dotfiles binaries #===[ PROMPTS ]=== -export PS1=' -$( - pwd="$PWD" - [ "${PWD##$HOME**}" ] || pwd="~${PWD#$HOME}" - - jobs="$(jobs | wc -l)" - jobs="${jobs#0}" - - printf "\a\033]0;%s\007\n%s\n%s" "$pwd" "$jobs" -)$ ' +export PS1='$(ps1)' export PS2='| ' #===[ ALIAS ]=================================================================== @@ -53,11 +44,40 @@ alias lla='l -Alh' alias p='pwd' alias weather='curl -4 wttr.in' alias lines='find -name "*.[ch]" | xargs wc -l' +alias c='clear' alias vis="$VISUAL" #===[ FUNCTIONS ]=============================================================== +ps1() +{ + local code="$?" size="$(stty size)" color=41 jobs="$(jobs | wc -l)" + [ "$code" -eq 0 ] && code='' color=45 + + local pwd="$PWD" date="$(date +'%H:%M')" + [ -z "${PWD##$HOME**}" ] && pwd="~${PWD#$HOME}" + + # Fill with color + printf '\n\033[1;%sm\033[K' "$color" + + # PWD with $HOME replaced by ~ + printf ' %s' "$pwd" + + # Last error code if non-zero + printf '\r\033[%sC%s' "$((${size#* } / 2 - 1))" "$code" + + # Date in right corner + printf '\r\033[%sC%s' "$((${size#* } - ${#date} - 1))" "$date" + printf '\033[0m\n' + + # Non printable: terminal status, bell and cursor position + printf '\a\033]0;%s\007' "$pwd" + + # Last line fo prompt + printf "%s$ " "${jobs#0}" +} + tag() # DVTM automatic tagger { local tag="$1" @@ -70,6 +90,11 @@ tag() # DVTM automatic tagger $cmd "$@" } +x() +{ + find "${1-.}" -type f | vis-menu -l 7 +} + a() # Abduco(1) session manager { if [ "$ABDUCO" ] @@ -94,6 +119,7 @@ a() # Abduco(1) session manager cmd="$SHELL" printf 'session name: '; read name name="$(printf %s "$name" | tr ' \t' '--')" + [ -d "$HOME/Projects/$name" ] && cd "$HOME/Projects/$name" elif [ ! "$name" ] then return 1 fi @@ -124,7 +150,7 @@ r() # Dmenu for the console if stest -dqr -n "$cache" $PATH then stest -flx $PATH | sort -u | tee "$cache" else tee < "$cache" - fi | $FILTER + fi | vis-menu )" printf '\033]0;%s\007$ %s ' "$cmd" 1>&2 @@ -135,11 +161,11 @@ r() # Dmenu for the console alsamixer ) opt='-c 1' ;; feeds ) opt='read' ;; htop | s-nail | irc | rirc | agenda) : ;; - vis | less) opt="$(find -type f | $FILTER)" ;; + vis | less) opt="$(x)" ;; *) read opt if [ -z "${opt##*\**}" -a "$opt" ] - then opt="${opt##*\*} $(find | $FILTER) ${opt%%\**}" + then opt="${opt##*\*} $(x) ${opt%%\**}" fi ;; esac @@ -155,7 +181,7 @@ light() -name brightness)" } -mnt() # Mount /dev/sdb1 or $1 in /mnt +mnt() # Mount /dev/sdb1 or $1 in /mnt { sudo mount -o uid=$USER -o rw ${1-/dev/sdb1} ${2-/mnt} } @@ -180,7 +206,7 @@ extract() esac } -sanitize() # Remove spaces and other nasty characters from $1 recursively +sanitize() # Remove spaces and other nasty characters from $1 recursively { find "$1" | while read p do mv "$p" "$(printf '%s\n' "$p" | sed 's/[^[:alnum:],._/+-]/_/g')" @@ -194,14 +220,6 @@ buildit() make && make clean PREFIX=$PREFIX install clean } -color() -{ - for color in 0 1 2 3 4 5 6 7 - do printf " \033[3${color}m██\033[1m██\033[0m" - done - printf '\n' -} - fbv() # FrameBuffer Video player based on ffplay { local x="$(sed 's/,.*//' /sys/class/graphics/fb0/virtual_size)" @@ -241,8 +259,45 @@ todo() bkm() # Bookmark manager { - url="$($FILTER < $DOT/doc/bookmarks)" - [ "${url##* }" ] && TERM=screen $BROWSER "${url##* }" + local bookmarks="$DOT/doc/bookmarks" + + if [ "$#" -ne 0 ] + then + printf 'url: '; read url + printf 'description: '; read description + tag="$(sed -r 's/^([^ ]*).*/\1/' "$bookmarks" | uniq | $FILTER)" + [ -z "$tag" ] && printf 'tag: '; read tag + printf '%s %s %s\n' "$url" "$description" "$tag" + sort "$bookmarks" | awk 'BEGIN{ + max1=0; + max2=0; +} + +{ + l++; + + c1[l] = $1; # First column + + for (i=2; i < NF; i++) { # Middle column + c2[l] = c2[l]$(i)(i<NF?OFS:""); + } + + c3[l] = $NF; # Last column + + max1 = ((length(c1[l]) > max1) ? length(c1[l]) : max1); + max2 = ((length(c2[l]) > max2) ? length(c2[l]) : max2); +} + +END { + for (i = 1; i <= l; i++) { + printf("%-"max1"s %-"max2"s %s\n", c1[i], c2[i], c3[i]); + } +}' + + else + url="$($FILTER < $bookmarks)" + [ "${url##* }" ] && TERM=screen $BROWSER "${url##* }" + fi } #===[ TTY SETUP ]=============================================================== @@ -270,7 +325,3 @@ then printf "$coal" # Theme printf '\033[?6;c' # Cursor style fi - -#===[ STARTUP ]================================================================= - -color