From 2abba7243a736a2fc626f3cc917d8a67014d4d20 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 5 Jun 2015 11:21:22 +0100 Subject: 35386: expand tabs where useful in builtins outputing function. Also add to zed -f. Option is -x . --- Functions/Misc/zed | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'Functions') diff --git a/Functions/Misc/zed b/Functions/Misc/zed index c2caaf3f5..010b69bee 100644 --- a/Functions/Misc/zed +++ b/Functions/Misc/zed @@ -9,8 +9,9 @@ local var opt zed_file_name # We do not want timeout while we are editing a file integer TMOUT=0 okargs=1 fun bind +local -a expand -while getopts "fb" opt; do +while getopts "fbx:" opt; do case $opt in (f) fun=1 @@ -19,6 +20,14 @@ while getopts "fb" opt; do (b) bind=1 ;; + + (x) + if [[ $OPTARG != <-> ]]; then + print -r "Integer expected after -x: $OPTARG" >&2 + return 1 + fi + expand=(-x $OPTARG) + ;; esac done shift $(( OPTIND - 1 )) @@ -29,8 +38,8 @@ shift $(( OPTIND - 1 )) if (( $# != okargs )); then echo 'Usage: zed filename -zed -f function -zed -b' +zed -f [ -x N ] function +zed -b' >&2 return 1 fi @@ -71,7 +80,7 @@ fi setopt localoptions nobanghist if ((fun)) then - var="$(functions $1)" + var="$(functions $expand $1)" # If function is undefined but autoloadable, load it if [[ $var = *\#\ undefined* ]] then var="$(autoload +X $1; functions $1)" -- cgit 1.4.1