diff options
author | Rory Dudley | 2024-05-20 11:27:45 -0600 |
---|---|---|
committer | Rory Dudley | 2024-05-20 11:27:45 -0600 |
commit | 8a7af4aacc0d67a9887ca1fd665b1694fd62a8ca (patch) | |
tree | 8bd0ec21d289e558925d15663b490b9873f257ea /src/poem/elements/stanza.rs | |
parent | 1bb25591b77a14a17bd05d79316ce703bcbcc3a6 (diff) | |
download | dwarvish-8a7af4aacc0d67a9887ca1fd665b1694fd62a8ca.tar.gz |
Allow aliases with the same name as their verb
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.
Diffstat (limited to 'src/poem/elements/stanza.rs')
0 files changed, 0 insertions, 0 deletions