[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 27dab7e198dbc5d7fe20766dc0e01174d7b8f946
Ville Skyttä
ville.skytta at iki.fi
Tue Oct 5 21:01:15 UTC 2010
The following commit has been merged in the master branch:
commit 27dab7e198dbc5d7fe20766dc0e01174d7b8f946
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Tue Oct 5 23:59:09 2010 +0300
Allow setting option for creating output to parse in _parse_help().
Required in just added sysbench completion.
diff --git a/bash_completion b/bash_completion
index a34015c..1ba2d07 100644
--- a/bash_completion
+++ b/bash_completion
@@ -706,12 +706,12 @@ _split_longopt()
return 1
}
-# This function tries to parse the output of $command --help
+# This function tries to parse the help output of the given command.
+# @param $1 command
+# @param $2 command options (default: --help)
#
_parse_help() {
- local cmd
- cmd=$1
- $cmd --help 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \
+ $1 ${2:---help} 2>&1 | command grep -- "^[[:space:]]*-" | tr "," " " | \
awk '{print $1; if ($2 ~ /-.*/) { print $2 } }' | sed -e "s:=.*::g"
}
--
bash-completion
More information about the Bash-completion-commits
mailing list