summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology/alias.rs
Commit message (Collapse)AuthorAgeFilesLines
* Add better support for aliasesRory Dudley2024-04-041-8/+16
| | | | | | | | | | | | | | | Make sure to interpret alias values as their own poems, since aliases can be fairly complex. Notes: Previously, I was doing a simple find and replace for aliases within each verse. However, aliases can be fairly complex, containing their own range of meters, commands, and io operations. This could cause problems, since a verse should never have, for instance, a pipe (`|`) in the middle of it. This patch fixes it, so that we iterate once through the poem, generating a new poem based on aliases that are found. In order to avoid two loops in the recite() function, it might make sense to offload handling aliases to read().
* Add docstring comments to all the anthology functionsRory Dudley2024-03-311-0/+18
| | | | | | Add docstring comments for all the incant function throughout the anthology, documenting what each function does, and an example of it's shell command.
* Add the 'alias' built-in commandRory Dudley2024-03-301-0/+47
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.