summary refs log tree commit diff stats
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-02-04 12:04:16 +0100
committernfnty <git@nfnty.se>2017-02-04 12:05:45 +0100
commit1f7e0890bbdf64d83e0537348679e8f916f6048b (patch)
tree5861427d622f6cc51b81be05dbad426e15f1dfd4
parent7a1933ff3eb14c0943411a3a2ded0e18904a01a3 (diff)
downloadranger-1f7e0890bbdf64d83e0537348679e8f916f6048b.tar.gz
api.commands: Fix function and alias commands names
-rw-r--r--ranger/api/commands.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 763e2fef..ba171553 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -365,19 +365,16 @@ class Command(FileManagerAware):
 
 def command_alias_factory(name, cls, full_command):
     class CommandAlias(cls):   # pylint: disable=too-few-public-methods
-        __name__ = name
-
         def __init__(self, line, *args, **kwargs):
             super(CommandAlias, self).__init__(
                 (full_command + ''.join(_ALIAS_LINE_RE.split(line)[1:])), *args, **kwargs)
+
+    CommandAlias.__name__ = name
     return CommandAlias
 
 
 def command_function_factory(func):
     class CommandFunction(Command):
-        __name__ = func.__name__
-        __doc__ = func.__doc__
-
         def execute(self):  # pylint: disable=too-many-branches
             if not func:
                 return
@@ -424,6 +421,9 @@ def command_function_factory(func):
                     raise
                 self.fm.notify("Bad arguments for %s: %s, %s" % (func.__name__, args, kwargs),
                                bad=True)
+
+    CommandFunction.__doc__ = func.__doc__
+    CommandFunction.__name__ = func.__name__
     return CommandFunction