Method code for $has_commands.add_shortcut()

[Turn on line numbering]
arg shortcut, template, method;
var relation;

(> .perms(sender()) <);
if (type(shortcut) != 'string || type(template) != 'string)
    throw(~type, "Both shortcut and template must be strings.");
if (type(method) != 'symbol)
    throw(~type, "Method must be submitted as a symbol.");
relation = (> $command_lib.parse_relation(shortcut, template) <);
shortcut = relation[1][1];
relation = relation[2][2];
if (!shortcuts)
    shortcuts = #[];
shortcuts = shortcuts.add(shortcut, [method, relation]);

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark