diff options
author | Swapnil Negi <swapnil.negi09@gmail.com> | 2018-04-03 16:04:54 +0530 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-04-28 15:55:50 +0200 |
commit | 9b3e719af6de6d695b3acddc38590f7daee7a2eb (patch) | |
tree | 3562ec6f0025d19c281cc6016b67a8762be478c6 | |
parent | 3068ab96dda9a05b4e3a6178354d6e228b4bf18d (diff) |
gr_modtool rm: block candidates
Fixes 1604
-rw-r--r-- | gr-utils/python/modtool/modtool_rm.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gr-utils/python/modtool/modtool_rm.py b/gr-utils/python/modtool/modtool_rm.py index 3393942af0..79d8344a72 100644 --- a/gr-utils/python/modtool/modtool_rm.py +++ b/gr-utils/python/modtool/modtool_rm.py @@ -38,6 +38,17 @@ class ModToolRemove(ModTool): def __init__(self): ModTool.__init__(self) + def get_block_candidates(self): + cpp_blocks = filter(lambda x: not (x.startswith('qa_') or + x.startswith('test_')), + glob.glob1("lib", "*.cc")) + python_blocks = filter(lambda x: not (x.startswith('qa_') or + x.startswith('build') or + x.startswith('__init__')), + glob.glob1("python", "*.py")) + block_candidates = [x.split('_impl')[0] for x in cpp_blocks] + [x.split('.')[0] for x in python_blocks] + return block_candidates + def setup(self, options, args): ModTool.setup(self, options, args) @@ -46,7 +57,8 @@ class ModToolRemove(ModTool): elif len(args) >= 2: self._info['pattern'] = args[1] else: - with SequenceCompleter(): + block_candidates = self.get_block_candidates() + with SequenceCompleter(block_candidates): self._info['pattern'] = raw_input('Which blocks do you want to delete? (Regex): ') if not self._info['pattern'] or self._info['pattern'].isspace(): self._info['pattern'] = '.' |