# -*- shell-script -*- # "set editing" debugger command # # Copyright (C) 2010-2011, 2016 Rocky Bernstein # # 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_sub set editing \ '**set editing** [**on**|**off**|**emacs**|**vi**] Readline editing of command lines See also: --------- **show editing** ' _Dbg_next_complete[set editing]='_Dbg_complete_edit' proc _Dbg_complete_edit { global COMPREPLY := '('on off vi emacs) } proc _Dbg_do_set_editing { typeset onoff=$(1:-'on') matchstr $onoff { e | em | ema | emac | emacs { global _Dbg_edit := ''-e'' global _Dbg_edit_style := ''emacs'' } on | 1 { global _Dbg_edit := ''-e'' global _Dbg_edit_style := ''emacs'' } off | 0 { global _Dbg_edit := '''' return 0 } v | vi { global _Dbg_edit := ''-e'' global _Dbg_edit_style := ''vi'' } * { _Dbg_errmsg '"on", "off", "vi", or "emacs" expected.' return 1 } } set -o $_Dbg_edit_style _Dbg_do_show_editing return 0 } (CommandList children: [ (C {(_Dbg_help_add_sub)} {(set)} {(editing)} { (SQ <"**set editing** [**on**|**off**|**emacs**|**vi**]\n"> <"\n"> <"Readline editing of command lines\n"> <"\n"> <"See also:\n"> <"---------\n"> <"\n"> <"**show editing**\n"> ) } ) (C {(_Dbg_next_complete) (Lit_Other "[") (set)} {(editing) (Lit_Other "]") (Lit_Other "=") (SQ <_Dbg_complete_edit>)} ) (FuncDef name: _Dbg_complete_edit body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:COMPREPLY) op: Equal rhs: {(ArrayLiteralPart words:[{(on)}{(off)}{(vi)}{(emacs)}])} spids: [96] ) ] spids: [96] ) ] spids: [93] ) spids: [89 92] ) (FuncDef name: _Dbg_do_set_editing body: (BraceGroup children: [ (C {(typeset)} {(Lit_VarLike "onoff=") (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [120 126] ) } ) (Case to_match: {($ VSub_Name "$onoff")} arms: [ (case_arm pat_list: [{(e)} {(em)} {(ema)} {(emac)} {(emacs)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_edit) op: Equal rhs: {(SQ <-e>)} spids: [157] ) ] spids: [157] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_edit_style) op: Equal rhs: {(SQ )} spids: [163] ) ] spids: [163] ) ] spids: [136 154 169 -1] ) (case_arm pat_list: [{(on)} {(1)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_edit) op: Equal rhs: {(SQ <-e>)} spids: [181] ) ] spids: [181] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_edit_style) op: Equal rhs: {(SQ )} spids: [187] ) ] spids: [187] ) ] spids: [172 178 193 -1] ) (case_arm pat_list: [{(off)} {(0)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_edit) op: Equal rhs: {(SQ )} spids: [205] ) ] spids: [205] ) (ControlFlow token: arg_word:{(0)}) ] spids: [196 202 215 -1] ) (case_arm pat_list: [{(v)} {(vi)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_edit) op: Equal rhs: {(SQ <-e>)} spids: [227] ) ] spids: [227] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_Dbg_edit_style) op: Equal rhs: {(SQ )} spids: [233] ) ] spids: [233] ) ] spids: [218 224 239 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (C {(_Dbg_errmsg)} {(SQ <"\"on\", \"off\", \"vi\", or \"emacs\" expected.">)}) (ControlFlow token: arg_word:{(1)}) ] spids: [242 244 -1 259] ) ] spids: [129 133 259] ) (C {(set)} {(-o)} {($ VSub_Name "$_Dbg_edit_style")}) (C {(_Dbg_do_show_editing)}) (ControlFlow token: arg_word:{(0)}) ] spids: [114] ) spids: [110 113] ) ] )