From 68d0b397d2256ab23889cf709c851d2a73585ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20R=C4=B1za=20KESK=C4=B0N?= Date: Fri, 7 May 2021 20:03:59 +0300 Subject: [PATCH] =?UTF-8?q?cli=20komut=20uzunlu=C4=9Fu=20s=C4=B1n=C4=B1r?= =?UTF-8?q?=C4=B1=202=20yerine=20sonsuz=20oldu=20:D=20ve=20komutlar=C4=B1?= =?UTF-8?q?=20art=C4=B1k=20yerel=20dilde=20de=20alg=C4=B1layabiliyor.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inary/cli/command.py | 24 +++++++++++++----------- inary/cli/init.py | 2 +- po/tr.po | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/inary/cli/command.py b/inary/cli/command.py index 88b98de4..72bcf672 100644 --- a/inary/cli/command.py +++ b/inary/cli/command.py @@ -35,20 +35,22 @@ class autocommand(type): name = getattr(cls, 'name', None) if name is None: raise inary.cli.Error(_('Command lacks name.')) - longname, shortname = name - - def add_cmd(cmd): + + def add_cmd(cmd,skip_duplicate=False): if cmd in Command.cmd_dict: - raise inary.cli.Error( - _('Duplicate command \'{}\'').format(cmd)) + if not skip_duplicate: + raise inary.cli.Error( + _('Duplicate command \'{}\'').format(cmd)) else: Command.cmd_dict[cmd] = cls - add_cmd(longname) - if shortname: - add_cmd(shortname) - + for cmd_name in name: + if cmd_name: + add_cmd(cmd_name) + add_cmd(_(name[0]),True) + + class Command(object): """generic help string for any command""" @@ -65,10 +67,10 @@ class Command(object): commandcls = Command.cmd_dict[name] trans = gettext.translation('inary', fallback=True) summary = trans.gettext(commandcls.__doc__).split('\n')[0] - name = commandcls.name[0] + name = _(commandcls.name[0]) if commandcls.name[1]: name += ' ({})'.format(commandcls.name[1]) - s += util.colorize(' %23s ' % name, 'blue') + '- %s\n' % summary + s += util.colorize(' %23s ' % name, 'red') + '- %s\n' % summary return s @staticmethod diff --git a/inary/cli/init.py b/inary/cli/init.py index 497981a1..5a122e74 100644 --- a/inary/cli/init.py +++ b/inary/cli/init.py @@ -28,7 +28,7 @@ class InitNothing(command.PackageOp, metaclass=command.autocommand): def __init__(self, args): super(InitNothing, self).__init__(args) - name = (_("init"), "i") + name = ("init", "i") def options(self): pass diff --git a/po/tr.po b/po/tr.po index 4d40ebfc..8ed69c15 100644 --- a/po/tr.po +++ b/po/tr.po @@ -3708,6 +3708,7 @@ msgstr "\"{0}\" için dönüş değeri {1}" msgid "Invalid version string: '{}'" msgstr "Hatalı sürüm dizgisi: '{}'" + #~ msgid "Upgrade is not possible." #~ msgstr "Yükseltme mümkün değil." -- 2.18.1