LavishScript:Aliases

From Lavish Software Wiki
Revision as of 21:41, 22 July 2005 by Lax (talk | contribs)
Jump to navigation Jump to search

Overview

An alias is something that means the same as another, also meaning "also known as" (alias 'aka'). In the LavishScript context, an alias is a way to make your own name for a command, possibly customizing the parameters along the way.

Simple Aliases

A simple alias is simply a sequence of text to replace a single word. For example, if you want to enter "binds" to mean "bind -list", you would make an alias like so:

Alias binds bind -list

This simply means that when you enter "binds", it will be replaced with "bind -list". Any further parameters you add will get placed after the replacement. This makes it easy to rename commands entirely. For example, you could alias "print" to "echo", and then use "print" exactly as if it were echo.

Complex Aliases

LavishScript 1.36 introduced the idea of complex aliases. A complex alias is one that may rearrange or even ignore any of the parameters given. To achieve this, complex aliases use special keywords, which are $$1 through $$9, $$- and $$+. Unlike simple aliases, the remaining text after replacement does not get placed after the replacement.

Here are the meanings of the special keywords:

  • $$1
1st parameter (same for $$1 through $$9, nth parameter)
  • $$9
9th parameter
  • $$-
"Rest of" parameters
  • $$+
All parameters

Examples

Inner Space
  • alias Rescale WindowSize -rescale -viewable $$1
Used like "Rescale 1280x1024" will execute "WindowSize -rescale -viewable 1280x1024"

See Also