File: help.sh

package info (click to toggle)
zshdb 0.04%2Bgit20100102-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,924 kB
  • ctags: 241
  • sloc: sh: 5,097; lisp: 885; makefile: 306
file content (239 lines) | stat: -rw-r--r-- 7,834 bytes parent folder | download
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# -*- shell-script -*-
# help.sh - Debugger Help Routines
#   Copyright (C) 2008 Rocky Bernstein rocky@gnu.org
#
#   zshdb 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.
#
#   zshdb 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 zshdb; see the file COPYING.  If not, write to the Free Software
#   Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.

# A place to put help command text
typeset -A _Dbg_command_help
export _Dbg_command_help

# Add help text $2 for command $1
function _Dbg_help_add {
    (($# != 2)) && return 1
     _Dbg_command_help[$1]="$2"
     return 0
}

typeset _Dbg_set_cmds='args annotate autoeval basename debugger 
force inferior-tty linetrace listsize prompt trace-commands width'

_Dbg_help_set() {

  if (( $# == 0 )) ; then 
      typeset thing
      for thing in $_Dbg_set_cmds ; do 
	_Dbg_help_set $thing 1
      done
      return 0
  fi

  typeset set_cmd="$1"
  typeset label="$2"

  case $set_cmd in 
    ar | arg | args )
      [[ -n $label ]] && label='set args -- '
      _Dbg_msg \
"${label}Set argument list to give program being debugged when it is started.
Follow this command with any number of args, to be passed to the program."
      return 0
      ;;
    an | ann | anno | annot | annota | annotat | annotate )
      if [[ -n $label ]] ; then 
	label='set annotate  -- '
      else
	typeset post_label='
0 == normal;     1 == fullname (for use when running under emacs).'
      fi
      _Dbg_msg \
"${label}Set annotation level.$post_label"
      return 0
      ;;
    au | aut | auto | autoe | autoev | autoeva | autoeval )
      [[ -n $label ]] && label='set autoeval  -- '
      typeset onoff="off."
      (( $_Dbg_autoeval != 0 )) && onoff='on.'
      _Dbg_msg \
"${label}Evaluate unrecognized commands is" $onoff
      return 0
      ;;
    b | ba | bas | base | basen | basena | basenam | basename )
      [[ -n $label ]] && label='set basename  -- '
      typeset onoff="off."
      (( $_Dbg_basename_only != 0 )) && onoff='on.'
      _Dbg_msg \
"${label}Set short filenames (the basename) in debug output is" $onoff
      return 0
      ;;
    d|de|deb|debu|debug|debugg|debugger|debuggi|debuggin|debugging )
      typeset onoff=${1:-'on'}
      [[ -n $label ]] && label='set debugger  -- '
      (( $_Dbg_debug_debugger )) && onoff='on.'
     _Dbg_msg \
"${label}Set debugging the debugger is" $onoff
      return 0
      ;;
    force )
      [[ -n $label ]] && label='set force     -- '
      typeset onoff="off."
      (( $_Dbg_edit )) && onoff='on.'
      _Dbg_msg \
"${label}Set stepping forces a different line is" $onoff
      ;;
    inferior-tty )
     [[ -n $label ]] && label='set inferior-tty -- '
      _Dbg_msg "${label} set tty for input and output"
      ;;
    lin | line | linet | linetr | linetra | linetrac | linetrace )
      [[ -n $label ]] && label='set linetrace -- '
      typeset onoff='off.'
      (( $_Dbg_linetrace )) && onoff='on.'
     _Dbg_msg \
"${label}Set tracing execution of lines before executed is" $onoff
      if (( $_Dbg_linetrace )) ; then
	  _Dbg_msg \
"set linetrace delay -- delay before executing a line is" $_Dbg_linetrace_delay
      fi
      return 0
      ;;
     lis | list | lists | listsi | listsiz | listsize )
      [[ -n $label ]] && label='set listsize  -- '
      _Dbg_msg \
"${label}Set number of source lines $_Dbg_debugger_name will list by default."
      ;;
    p | pr | pro | prom | promp | prompt )
      [[ -n $label ]] && label='set 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='set showcommand -- '
      _Dbg_msg \
"${label}Set showing the command to execute is $_Dbg_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='set trace-commands -- '
      _Dbg_msg \
"${label}Set showing debugger commands is $_Dbg_trace_commands."
      return 0
      ;;
     w | wi | wid | widt | width )
      [[ -n $label ]] && label='set width          -- '
      _Dbg_msg \
"${label}Set line length to use in output."
      ;;
    * )
      _Dbg_msg \
"There is no \"set $set_cmd\" command."
  esac
}

# typeset _Dbg_show_cmds="aliases annotate args autoeval basename debugger commands debugger directories linetrace listsize prompt trace-commands warranty"

typeset _Dbg_show_cmds="aliases annotate args autoeval basename commands 
copying debugger force linetrace listsize prompt trace-commands warranty"

_Dbg_help_show() {
  typeset show_cmd=$1

  if [[ -z $show_cmd ]] ; then 
      typeset thing
      for thing in $_Dbg_show_cmds ; do 
	_Dbg_help_show $thing 1
      done
      return
  fi

  case $show_cmd in 
    al | ali | alia | alias | aliase | aliases )
      _Dbg_msg \
'show aliases     -- Show list of aliases currently in effect.'
      return 0
      ;;
    ar | arg | args )
      _Dbg_msg \
'show args        -- Show argument list to give program being debugged when it 
                    is started.'
      return 0
      ;;
    an | ann | anno | annot | annota | annotat | annotate )
      _Dbg_msg \
"show annotate    -- Show annotation_level"
      return 0
      ;;
    au | aut | auto | autoe | autoev | autoeva | autoeval )
      _Dbg_msg \
'show autoeval    -- Show if we evaluate unrecognized commands.'
      return 0
      ;;
    b | ba | bas | base | basen | basena | basenam | basename )
      _Dbg_msg \
'show basename    -- Show if we are are to show short or long filenames.'
      return 0
      ;;
    com | comm | comma | comman | command | commands )
      _Dbg_msg \
'show commands    -- Show the history of commands you typed.'
      ;;
    cop | copy| copyi | copyin | copying )
      _Dbg_msg \
'show copying     -- Conditions for redistributing copies of debugger.'
     ;;
    d|de|deb|debu|debug|debugg|debugger|debuggi|debuggin|debugging )
     _Dbg_msg \
'show debugger    -- Show if we are set to debug the debugger.'
      return 0
      ;;
    di|dir|dire|direc|direct|directo|director|directori|directorie|directories)
      _Dbg_msg \
'show directories -- Show if we are set to debug the debugger.'
      ;;
    force)
      _Dbg_msg \
'show force       -- Show if setting forces a different line.'
      ;;
    lin | line | linet | linetr | linetra | linetrac | linetrace )
      _Dbg_msg \
'show linetrace   -- Show whether to trace lines before execution.'
      ;;
    lis | list | lists | listsi | listsiz | listsize )
      _Dbg_msg \
'show listsize    -- Show number of source lines debugger will list by default.'
      ;;
    p | pr | pro | prom | promp | prompt )
      _Dbg_msg \
"show prompt      -- Show debugger's prompt."
      return 0
      ;;
    t|tr|tra|trac|trace|trace-|trace-c|trace-co|trace-com|trace-comm|trace-comma|trace-comman|trace-command|trace-commands )
      _Dbg_msg \
'show trace-commands -- Show if we are echoing debugger commands'
      return 0
      ;;
    w | wa | war | warr | warra | warran | warrant | warranty )
      _Dbg_msg \
'show warranty    -- Various kinds of warranty you do not have.'
      return 0
      ;;
    * )
      _Dbg_msg \
    "Undefined show command: \"$show_cmd\".  Try \"help show\"."
  esac
}