File: show.sh

package info (click to toggle)
zshdb 0.05%2Bgit20101031-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,104 kB
  • ctags: 209
  • sloc: sh: 5,563; makefile: 337
file content (186 lines) | stat: -rw-r--r-- 5,726 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# -*- shell-script -*-
# show.sh - Show debugger settings
#
#   Copyright (C) 2008, 2010 Rocky Bernstein rocky@gnu.org
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License as
#   published by the Free Software Foundation; either version 2, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   General Public License for more details.
#   
#   You should have received a copy of the GNU General Public License
#   along with This program; see the file COPYING.  If not, write to
#   the Free Software Foundation, 59 Temple Place, Suite 330, Boston,
#   MA 02111 USA.

_Dbg_help_add show ''  # Help routine is elsewhere

# Load in "show" subcommands
for _Dbg_file in ${_Dbg_libdir}/command/show_sub/*.sh ; do 
    source $_Dbg_file
done

_Dbg_do_show() {
    typeset show_cmd=$1
    typeset label=$2

    # Warranty, copying, directories, and aliases are omitted below.
    typeset subcmds='annotate args autoeval autolist basename debugging editing force listsize prompt trace-commands width'
    
    if [[ -z $show_cmd ]] ; then 
	typeset thing
	for thing in $subcmds ; do 
	    _Dbg_do_show $thing 1
	done
	return 0
    fi

    case $show_cmd in 
	al | ali | alia | alias | aliase | aliases )
	    _Dbg_do_show_alias
	    return $?
	    ;;
	ar | arg | args )
	    [[ -n $label ]] && label='args:     '
	    _Dbg_msg \
		"${label}Argument list to give script when debugged program starts is:\n" \
		"      \"${_Dbg_script_args[@]}\"."
	    return 0
	    ;;
	an | ann | anno | annot | annota | annotat | annotate )
	    [[ -n $label ]] && label='annotate: '
	    _Dbg_msg \
		"${label}Annotation_level is $_Dbg_set_annotate."
            return 0
	    ;;
	autoe | autoev | autoeva | autoeval )
	    [[ -n $label ]] && label='autoeval: '
	    _Dbg_msg \
		"${label}Evaluate unrecognized commands is" $(_Dbg_onoff $_Dbg_set_autoeval)
	    return 0
	    ;;
	autol | autoli | autolis | autolist )
	    [[ -n $label ]] && label='autolist: '
	    typeset onoff="on."
	    [[ -z ${_Dbg_cmdloop_hooks["list"]} ]] && onoff='off.'
	    _Dbg_msg \
		"${label}Auto run of 'list' command is ${onoff}"
	    return 0
	    ;;
	b | ba | bas | base | basen | basena | basenam | basename )
	    [[ -n $label ]] && label='basename: '
	    _Dbg_msg \
		"${label}Show short filenames (the basename) in debug output is" $(_Dbg_onoff $_Dbg_set_basename)
	    return 0
	    ;;
	com | comm | comma | comman | command | commands )
	    shift # shift off "commands"
	    _Dbg_history_list $*
	    return $?
	    ;;
	cop | copy| copyi | copyin | copying )
	    _Dbg_do_show_copying
	    return $?
	    ;;
	de|deb|debu|debug|debugg|debugger|debuggi|debuggin|debugging )
	    [[ -n $label ]] && label='debugging: '
	    _Dbg_do_show_debugging $label
	    return $?
	    ;;
	dir|dire|direc|direct|directo|director|directori|directorie|directories)
	    typeset list=${_Dbg_dir[0]}
	    typeset -i n=${#_Dbg_dir[@]}
	    typeset -i i
	    for (( i=1 ; i < n; i++ )) ; do
		list="${list}:${_Dbg_dir[i]}"
	    done

	    _Dbg_msg "Source directories searched: $list"
	    return 0
	    ;;
	e | ed | edi | edit | editi | editin | editing )
	    _Dbg_do_show_editing "$label"
	    return 0
	    ;;
	force | diff | differ | different )
	    [[ -n $label ]] && label='different: '
	    _Dbg_msg \
		"${label}Show stepping forces a new line is" $(_Dbg_onoff $_Dbg_set_different)
	    return 0
	    ;;
	hi|his|hist|histo|histor|history)
	    _Dbg_do_show_history
	    return $?
	    ;;

	lin | line | linet | linetr | linetra | linetrac | linetrace )
	    [[ -n $label ]] && label='line tracing: '
	    typeset onoff="off."
	    (( $_Dbg_linetrace != 0 )) && onoff='on.'
	    _Dbg_msg \
		"${label}Show line tracing is" $onoff
	    _Dbg_msg \
		"${label}Show line trace delay is ${_Dbg_linetrace_delay}."
	    return 0
	    ;;

	lis | list | lists | listsi | listsiz | listsize )
	    [[ -n $label ]] && label='listsize: '
	    _Dbg_msg \
		"${label}Number of source lines ${_Dbg_debugger_name} will list by default is" \
		"$_Dbg_set_listsize."
	    return 0
	    ;;

	lo | log | logg | loggi | loggin | logging )
	    shift
	    _Dbg_do_show_logging $*
	    ;;
	p | pr | pro | prom | promp | prompt )
	    [[ -n $label ]] && label='prompt:   '
	    _Dbg_msg \
		"${label}${_Dbg_debugger_name}'s prompt is:\n" \
		"      \"$_Dbg_prompt_str\"."
	    return 0
	    ;;
	sho|show|showc|showco|showcom|showcomm|showcomma|showcomman|showcommand )
	    [[ -n $label ]] && label='showcommand: '
	    _Dbg_msg \
		"${label}Show commands in debugger prompt is" \
		"$_Dbg_set_show_command."
	    return 0
	    ;;
	t|tr|tra|trac|trace|trace-|tracec|trace-co|trace-com|trace-comm|trace-comma|trace-comman|trace-command|trace-commands )
	    [[ -n $label ]] && label='trace-commands: '
	    _Dbg_msg \
		"${label}State of command tracing is" \
		"$_Dbg_set_trace_commands."
	    return 0
	    ;;
	v | ve | ver | vers | versi | versio | version )
	    _Dbg_do_show_version
	    return 0
	    ;;
	w | wa | war | warr | warra | warran | warrant | warranty )
	    _Dbg_do_info warranty
	    return 0
	    ;;
	wi | wid | width )
	    [[ -n $label ]] && label='width: '
	    _Dbg_msg \
		"${label}Line width is $_Dbg_set_linewidth."
	    return 0
	    ;;
	*)
	    _Dbg_errmsg "Unknown show subcommand: $show_cmd"
	    _Dbg_errmsg "Show subcommands are:"
	    typeset -a list; list=(${subcmds[@]})
	    _Dbg_list_columns '  ' _Dbg_errmsg
	    [[ $msg == '_Dbg_errmsg' ]] && return 1 || return 0
    esac
}