Fix add line number: report list position, not internal id
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4fdde9a9dc
commit
bb203a7356
@ -141,7 +141,9 @@ class Bot():
|
||||
rule = self.__config.add_subscription(src, ftype, value, dst, name=name)
|
||||
if rule is None:
|
||||
return "Already exists: {0} [{1}] '{2}' -> {3}".format(src, ftype, value, dst)
|
||||
return "Added #{0}: {1}".format(rule['id'], rule.get('name', ''))
|
||||
subs = self.__config.list_subscriptions()
|
||||
line_no = next((i + 1 for i, s in enumerate(subs) if s['id'] == rule['id']), '?')
|
||||
return "Added line {0}: {1}".format(line_no, rule.get('name', ''))
|
||||
if cmd in ('del', 'rm', 'delete'):
|
||||
line_no = int(parts[2])
|
||||
subs = self.__config.list_subscriptions()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user