Commands now have a .cmdset_source pointing at their original cmdset instance.
This commit is contained in:
parent
923ec28ec4
commit
ee3705cb81
2 changed files with 4 additions and 1 deletions
|
|
@ -541,6 +541,8 @@ class CmdSet(object, metaclass=_CmdSetMeta):
|
||||||
system_commands = self.system_commands
|
system_commands = self.system_commands
|
||||||
|
|
||||||
for cmd in cmds:
|
for cmd in cmds:
|
||||||
|
# Ensure commands know their source cmdset.
|
||||||
|
cmd.cmdset_source = self
|
||||||
# add all commands
|
# add all commands
|
||||||
if not hasattr(cmd, "obj") or cmd.obj is None:
|
if not hasattr(cmd, "obj") or cmd.obj is None:
|
||||||
cmd.obj = self.cmdsetobj
|
cmd.obj = self.cmdsetobj
|
||||||
|
|
|
||||||
|
|
@ -156,9 +156,10 @@ class Command(metaclass=CommandMeta):
|
||||||
you to know which alias was used, for example)
|
you to know which alias was used, for example)
|
||||||
self.args - everything supplied to the command following the cmdstring
|
self.args - everything supplied to the command following the cmdstring
|
||||||
(this is usually what is parsed in self.parse())
|
(this is usually what is parsed in self.parse())
|
||||||
self.cmdset - the cmdset from which this command was matched (useful only
|
self.cmdset - the merged cmdset from which this command was matched (useful only
|
||||||
seldomly, notably for help-type commands, to create dynamic
|
seldomly, notably for help-type commands, to create dynamic
|
||||||
help entries and lists)
|
help entries and lists)
|
||||||
|
self.cmdset_source - the specific cmdset this command was matched from.
|
||||||
self.obj - the object on which this command is defined. If a default command,
|
self.obj - the object on which this command is defined. If a default command,
|
||||||
this is usually the same as caller.
|
this is usually the same as caller.
|
||||||
self.raw_string - the full raw string input, including the command name,
|
self.raw_string - the full raw string input, including the command name,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue