Skip to content

Commit

Permalink
Make -S --style option work...
Browse files Browse the repository at this point in the history
And bump copyright
  • Loading branch information
rocky committed Dec 4, 2024
1 parent 2eced22 commit 19388d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
6 changes: 0 additions & 6 deletions command/set_sub/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
for file in help alias ; do source "$top_dir/lib/${file}.sh"; done
fi

typeset -x _Dbg_pygments_styles=''

if (( _Dbg_working_term_highlight )) ; then
_Dbg_pygments_styles=$("${_Dbg_libdir}/lib/term-highlight.py" -L)
fi

_Dbg_complete_style() {
COMPREPLY=( $_Dbg_pygments_styles off )
}
Expand Down
22 changes: 16 additions & 6 deletions init/opts.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- shell-script -*-
# debugger command options processing. The bane of programming.
#
# Copyright (C) 2008-2012, 2014-2019, 2021, 2023
# Copyright (C) 2008-2012, 2014-2019, 2021, 2023-2024
# Rocky Bernstein <[email protected]>
#
# This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -95,9 +95,11 @@ if ( pygmentize --version || pygmentize -V ) 2>/dev/null 1>/dev/null ; then
fi

typeset -ix _Dbg_working_term_highlight
typeset -x _Dbg_pygments_styles=''

if "${_Dbg_libdir}/lib/term-highlight.py" -V 2>/dev/null 1>/dev/null ; then
_Dbg_working_term_highlight=1
_Dbg_pygments_styles=$("${_Dbg_libdir}/lib/term-highlight.py" -L)
else
_Dbg_working_term_highlight=0
fi
Expand Down Expand Up @@ -133,7 +135,7 @@ _Dbg_parse_options() {
typeset -i _Dbg_highlight_enabled=1
typeset OPTLARG OPTLERR OPTLPENDING opt

while getopts_long A:Bc:x:hL:nqTt:Yy:VX opt \
while getopts_long A:Bc:x:hL:nqS:T:t:Yy:VX opt \
annotate required_argument \
basename no_argument \
command required_argument \
Expand All @@ -147,6 +149,7 @@ _Dbg_parse_options() {
no-init no_argument \
nx no_argument \
quiet no_argument \
style required_argument \
tempdir required_argument \
tty required_argument \
terminal required_argument \
Expand Down Expand Up @@ -178,7 +181,7 @@ _Dbg_parse_options() {
esac

if (( ! _Dbg_have_working_pygmentize )) ; then
printf "Can't run pygmentize. --highlight forced off" >&2
printf "Can't run pygmentize. --highlight forced off." >&2
_Dbg_highlight_enabled=0
_Dbg_set_highlight=''
fi
Expand All @@ -187,9 +190,7 @@ _Dbg_parse_options() {
_Dbg_highlight_enabled=0
_Dbg_set_highlight='' ;;
init-file )
set -x
_Dbg_o_init_files+="$OPTLARG"
set +x
;;
L | library ) ;;
V | version )
Expand All @@ -198,6 +199,15 @@ _Dbg_parse_options() {
_Dbg_o_nx=1 ;;
q | quiet )
_Dbg_o_quiet=1 ;;
S | style )
if (( ! _Dbg_have_working_pygmentize )) ; then
printf "Can't run pygmentize. --style option ignored." >&2
elif [[ "${_Dbg_pygments_styles#*$OPTLARG}" != "$_Dbg_pygments_styles" ]] ; then
_Dbg_set_style="$OPTLARG"
else
printf "Can't find style ${OPTLARG}; --style option ignored." >&1
fi
;;
tempdir)
_Dbg_tmpdir=$OPTLARG ;;
terminal | tty )
Expand Down Expand Up @@ -231,7 +241,7 @@ _Dbg_parse_options() {
[[ -n $_Dbg_release ]] ; then
echo "$_Dbg_shell_name debugger, $_Dbg_debugger_name, release $_Dbg_release"
printf '
Copyright 2002-2004, 2006-2012, 2014, 2016-2019, 2021, 2023 Rocky Bernstein
Copyright 2002-2004, 2006-2012, 2014, 2016-2019, 2021, 2023-2024 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Expand Down

0 comments on commit 19388d8

Please sign in to comment.