Skip to content

Commit

Permalink
Added auto_show installation helper
Browse files Browse the repository at this point in the history
  • Loading branch information
doekman committed Aug 21, 2018
1 parent 571abcd commit 143c290
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ok.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ if [[ $called == $0 ]]; then
echo "arguments, if you need to customize (these can also be set via arguments/environment):"
echo " prompt <prompt> Use the supplied prompt (e.g. prompt '> ')"
echo " prompt_default Prompt default when issueing running ok without arguments"
echo " auto_show Perform 'ok list-once' every time the prompt is shown (modifies \$PROMPT_COMMAND)"
echo " verbose Enable verbose mode"
echo " quiet Enable quiet mode"
echo
Expand All @@ -193,15 +194,19 @@ else
unset _OK_C_HEADING; unset _OK_C_NUMBER; unset _OK_C_COMMENT; unset _OK_C_COMMAND; unset _OK_C_PROMPT
unset _OK_PROMPT; unset _OK_PROMPT_DEFAULT; unset _OK_VERBOSE; unset _OK__LAST_PWD
# Process some installation helpers
re_list_once=$'ok list-once'
while (( $# > 0 )) ; do
case $1 in
prompt) if [[ $# -ge 2 ]]; then export _OK_PROMPT=$2; shift; else echo "the prompt argument needs the actual prompt as 2nd argument"; fi;;
prompt_default) export _OK_PROMPT_DEFAULT=1;;
verbose) export _OK_VERBOSE=2;;
quiet) export _OK_VERBOSE=0;;
auto_show) if [[ ! $PROMPT_COMMAND =~ $re_list_once ]]; then export PROMPT_COMMAND="$PROMPT_COMMAND
$re_list_once"; fi;;
*) echo "Ignoring unknown argument '$1'";;
esac
shift
done
unset re_list_once
fi
unset called

0 comments on commit 143c290

Please sign in to comment.