mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-24 11:04:05 +01:00
Aka: Escape the command in help strings, so they can be copy-pasted into @aka add.
This commit is contained in:
parent
5ee15c38bb
commit
0998651f61
@ -507,12 +507,15 @@ class Aka(callbacks.Plugin):
|
||||
lock = ' ' + _('Locked by %s at %s') % (locked_by, locked_at)
|
||||
else:
|
||||
lock = ''
|
||||
escaped_command = original.replace('\\', '\\\\').replace('"', '\\"')
|
||||
if channel == 'global':
|
||||
doc = format(_('<a global alias,%s %n>\n\nAlias for %q.%s'),
|
||||
flexargs, (biggestDollar, _('argument')), original, lock)
|
||||
flexargs, (biggestDollar, _('argument')),
|
||||
escaped_command, lock)
|
||||
else:
|
||||
doc = format(_('<an alias on %s,%s %n>\n\nAlias for %q.%s'),
|
||||
channel, flexargs, (biggestDollar, _('argument')), original, lock)
|
||||
channel, flexargs, (biggestDollar, _('argument')),
|
||||
escaped_command, lock)
|
||||
f = utils.python.changeFunctionName(f, name, doc)
|
||||
return f
|
||||
|
||||
|
@ -66,10 +66,10 @@ class AkaChannelTestCase(ChannelPluginTestCase):
|
||||
self.assertError('aka add unlock "echo foo bar baz"')
|
||||
|
||||
def testAkaHelp(self):
|
||||
self.assertNotError('aka add slashdot foo')
|
||||
self.assertRegexp('help slashdot', "Alias for .*foo")
|
||||
self.assertNotError(r'aka add slashdot "foo \"bar\" baz"')
|
||||
self.assertRegexp('help slashdot', r'Alias for "foo \\"bar\\" baz".')
|
||||
self.assertNotError('aka add nonascii echo éé')
|
||||
self.assertRegexp('help nonascii', "Alias for .*echo éé")
|
||||
self.assertRegexp('help nonascii', r'Alias for "echo éé".')
|
||||
|
||||
self.assertNotError('aka remove slashdot')
|
||||
self.assertNotError('aka add --channel %s slashdot foo' % self.channel)
|
||||
|
Loading…
Reference in New Issue
Block a user