Aliases

Ratchet has a rather complex and flexible alias system, it allows command chaining, the use of specific arguments, etc.

There are several sequences that Ratchet parses and replaces:

$<n> - insert the nth argument passed to the alias (counted from 0), negative numbers are counted from the end of the array (-1 is last argument, -2 is second last, etc) $<n>..<m> - insert a range of arguments between n and m. This is essentially a ruby range, if the last argument should be omitted, use 3 dots(...). Unlike ruby, Ratchet allows reverse ranges ($4..1, $-1..0), etc.

$@ - all arguments passed

$^ - all unused arguments for that line at the point the substitution is encountered

$! - force the line to have no arguments appended

$network, $presence, $username, $buffername are also substituted with the appropiate values

; - used to split commands, however as long as the next non-whitespace character isn't a /, Ratchet won't split by it so you can have ; in your alias strings for other purposes(eg. /alias test $0; $1)

Ratchet will append all arguments passed to a line if there are no $ substitutions performed, use $! to prevent this behaviour. Ratchet also defaults to sending a message if there is no command in the alias (eg. /alias test $@ will just send all arguments to the current buffer using Ratchet's cmd_message method), this only works for the initial command, for subsequent commands you must specify a command.

Examples A nickserv nickname recover alias:

/alias ghost /msg nickserv recover $0 $1; /msg nickserv release $0 $1; /nick $0; /msg nickserv identify $1
Usage is /ghost username password

Invert all arguments and send em as a message

/alias invert $-1..0

Cycle a channel:

/alias cycle /join; /part

To list all defined aliases use /aliases, to remove an alias use /unalias. Aliases are included in the /help and command completion for easy usage.

Clients/Ratchet/Aliases (last edited 2009-03-15 22:42:41 by localhost)