diff options
author | Ferenc Gerlits <fgerlits@gmail.com> | 2021-04-29 21:52:38 +0200 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2021-05-03 12:48:08 -0400 |
commit | faf786d57f48bc516c530bfd76e478b3748cd582 (patch) | |
tree | d0547b018122e2f196bdfa412c2ddc27bf23c53a /gr-utils/modtool/cli/rename.py | |
parent | 79d294331ca941cd16c42ddc07278c5ce749b938 (diff) |
modtool: improve the 'invalid name' error message
also fix some validations which checked a prefix instead of the whole name
Signed-off-by: Ferenc Gerlits <fgerlits@gmail.com>
Diffstat (limited to 'gr-utils/modtool/cli/rename.py')
-rw-r--r-- | gr-utils/modtool/cli/rename.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gr-utils/modtool/cli/rename.py b/gr-utils/modtool/cli/rename.py index 7d72fe630f..0e70867f39 100644 --- a/gr-utils/modtool/cli/rename.py +++ b/gr-utils/modtool/cli/rename.py @@ -13,7 +13,7 @@ import re import click -from ..core import get_block_candidates, ModToolRename +from ..core import get_block_candidates, ModToolRename, validate_name from ..tools import SequenceCompleter from .base import common_params, block_name, run, cli_input, ModToolException @@ -55,8 +55,7 @@ def get_oldname(self): if len(choices) > 0: click.secho("Suggested alternatives: "+str(choices), fg='yellow') raise ModToolException("Blockname for renaming does not exists!") - if not re.match('[a-zA-Z0-9_]+', self.info['oldname']): - raise ModToolException('Invalid block name.') + validate_name('block', self.info['oldname']) def get_newname(self): """ Get the new block name """ @@ -64,5 +63,4 @@ def get_newname(self): while not self.info['newname'] or self.info['newname'].isspace(): self.info['newname'] = cli_input("Enter name of block/code "+ "(without module name prefix): ") - if not re.match('[a-zA-Z0-9_]+', self.info['newname']): - raise ModToolException('Invalid block name.') + validate_name('block', self.info['newname']) |