| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, when trying to add an alias that used the same name as its
command, an infinite recursion loop would occur, and the program would
panic after the call stack got too deep. For instance, something like:
alias grep='grep --color=always'
would cause it to panic.
This patch adds a new field to the Environment struct called 'cs' (for
call stack), which can be used to keep track of how many levels deep
into the Poem::read() function we are in. At the moment, it only allows
going two levels deep, but since it's just a u8 value, this could be
increased in the future. The above example now works correctly, but it
does mean that aliases within aliases are not possible, currently.
|
|
|
|
|
|
|
|
|
|
|
| |
The shell now has support for aliases (via alias foo=bar). The 'unalias'
command is also available to remove aliases. Finally,
Environment::aliases was changed to be a HashMap<String, String>,
instead of a Vec<String>.
Since the verse's verb might change (for instance, it is an environment
variable, or an alias), add another check in Poem::recite, which simply
continues, instead of running the spellchecker, if the verb is empty.
|
|
Instead of having to pass around a bunch of different data structures
for various shell functions, create the wrapper compose::Environment,
which serves as a global shell state. It is configured via
login/profile/rc scripts initially, but can of course be modified
throughout the lifetime of the shell.
|