Skip to content

Commit c580cd3

Browse files
committed
Note "complete" is GNU-Readline complete
1 parent 183661d commit c580cd3

10 files changed

Lines changed: 26 additions & 22 deletions

File tree

trepan/debugger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Trepan:
6363
Class for a top-level object.
6464
"""
6565

66-
def __init__(self, opts=None):
66+
def __init__(self, opts=dict()):
6767
"""Create a debugger object. But depending on the value of
6868
key 'start' inside hash 'opts', we may or may not initially
6969
start debugging.

trepan/lib/complete.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2013, 2020, 2023 Rocky Bernstein <rocky@gnu.org>
2+
# Copyright (C) 2013, 2020, 2023-2024 Rocky Bernstein <rocky@gnu.org>
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,9 @@
1313
#
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
"""Command completion routines."""
16+
17+
# FIXME: add correspoding prompt_toolkit completion routines
18+
"""Command completion routines. GNU Readline/libedit only for now..."""
1719

1820
import re
1921

trepan/processor/command/info_subcmd/builtins.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2015 Rocky Bernstein <rocky@gnu.org>
2+
# Copyright (C) 2015, 2024 Rocky Bernstein <rocky@gnu.org>
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
1616

1717
# Our local modules
1818
from trepan.processor.command import base_subcmd as Mbase_subcmd
19-
from trepan.lib import complete as Mcomplete
19+
from trepan.lib.complete import complete_token
2020

2121

2222
class InfoBuiltins(Mbase_subcmd.DebuggerSubcommand):
@@ -31,7 +31,7 @@ class InfoBuiltins(Mbase_subcmd.DebuggerSubcommand):
3131

3232
def complete(self, prefix):
3333
completions = sorted(["*"] + self.proc.curframe.f_builtins.keys())
34-
return Mcomplete.complete_token(completions, prefix)
34+
return complete_token(completions, prefix)
3535

3636
def run(self, args):
3737
if not self.proc.curframe:

trepan/processor/command/info_subcmd/code.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
from trepan.lib import complete as Mcomplete
17+
from trepan.lib.complete import complete_token
1818
from trepan.processor import frame as Mframe
1919

2020
# Our local modules
@@ -54,7 +54,8 @@ def complete(self, prefix):
5454
low, high = Mframe.frame_low_high(proc_obj, None)
5555
ary = [str(low + i) for i in range(high - low + 1)]
5656
# FIXME: add in Thread names
57-
return Mcomplete.complete_token(ary, prefix)
57+
return complete_token(ary, prefix)
58+
5859

5960
def run(self, args):
6061
proc = self.proc

trepan/processor/command/info_subcmd/files.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import pyficache
2323

2424
from trepan import misc as Mmisc
25-
from trepan.lib import complete as Mcomplete
25+
from trepan.lib.complete import complete_token
2626
from trepan.lib.file import file_list
2727

2828
# Our local modules
@@ -34,9 +34,11 @@ class InfoFiles(DebuggerSubcommand):
3434
need_stack = False
3535
short_help = "Show information about an imported or loaded Python file"
3636

37+
3738
def complete(self, prefix):
3839
completions = sorted(["."] + file_list())
39-
return Mcomplete.complete_token(completions, prefix)
40+
return complete_token(completions, prefix)
41+
4042

4143
def run(self, args):
4244
"""**info files** [*filename* [**all** | **brkpts** | **sha1** | **size**]]

trepan/processor/command/info_subcmd/locals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# Our local modules
2323
from trepan.processor.command import base_subcmd as Mbase_subcmd
2424
from trepan.lib import pp as Mpp
25-
from trepan.lib import complete as Mcomplete
25+
from trepan.lib.complete import complete_token
2626

2727
# when the "with" statement is used, there
2828
# can be get variables having names
@@ -53,7 +53,7 @@ class InfoLocals(Mbase_subcmd.DebuggerSubcommand):
5353

5454
def complete(self, prefix):
5555
completions = sorted(["*"] + self.proc.curframe.f_locals.keys())
56-
return Mcomplete.complete_token(completions, prefix)
56+
return complete_token(completions, prefix)
5757

5858
def run(self, args):
5959
if not self.proc.curframe:

trepan/processor/command/info_subcmd/macro.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
# Our local modules
2020
from trepan.processor.command import base_subcmd as Mbase_subcmd
21-
from trepan.lib import complete as Mcomplete
21+
from trepan.lib.complete import complete_token
2222

2323

2424
class InfoMacro(Mbase_subcmd.DebuggerSubcommand):
@@ -39,7 +39,8 @@ class InfoMacro(Mbase_subcmd.DebuggerSubcommand):
3939

4040
def complete(self, prefix):
4141
m = sorted(list(self.proc.macros.keys()) + ["*"])
42-
return Mcomplete.complete_token(m, prefix)
42+
return complete_token(m, prefix)
43+
4344

4445
def run(self, args):
4546
if len(args) > 0:

trepan/processor/command/info_subcmd/signals.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2009, 2015, 2023 Rocky Bernstein <rocky@gnu.org>
2+
# Copyright (C) 2009, 2015, 2023-2024 Rocky Bernstein <rocky@gnu.org>
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
1616

1717
# Our local modules
1818
from trepan.processor.command import base_subcmd as Mbase_subcmd
19-
from trepan.lib import complete as Mcomplete
19+
from trepan.lib.complete import complete_token
2020

2121

2222
class InfoSignals(Mbase_subcmd.DebuggerSubcommand):
@@ -45,7 +45,8 @@ class InfoSignals(Mbase_subcmd.DebuggerSubcommand):
4545

4646
def complete(self, prefix):
4747
completions = sorted(["*"] + self.debugger.sigmgr.siglist)
48-
return Mcomplete.complete_token(completions, prefix)
48+
return complete_token(completions, prefix)
49+
4950

5051
def run(self, args):
5152
if len(args) > 0 and args[0] == "*":

trepan/processor/command/unalias.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#
1313
# You should have received a copy of the GNU General Public License
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
15-
1615
from trepan.lib.complete import complete_token
1716

1817
# Our local modules

trepan/processor/complete.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2013-2015, 2020 Rocky Bernstein <rocky@gnu.org>
2+
# Copyright (C) 2013-2015, 2020, 2024 Rocky Bernstein <rocky@gnu.org>
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -13,12 +13,10 @@
1313
#
1414
# You should have received a copy of the GNU General Public License
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
"CommandProcessor completion routines"
16+
"CommandProcessor GNU-readline/libedit completion routines"
1717
import pyficache
1818

1919
import trepan.lib.complete as Mcomplete
20-
21-
2220
def complete_token_filtered(aliases, prefix, expanded):
2321

2422
"""Find all starting matches in dictionary *aliases* that start

0 commit comments

Comments
 (0)