We may want to provide support for creating aliases for commands. For example we could alias the hello-world example command to hw or hello.
One way to approach this could be:
- Commands defining a
.alias.txt file, which contains their aliases.
- In
cli.sh as we loop through each command, we check if there is a .alias.txt file, and store the aliases from that file.
- We could structure
cli.sh so that as it's looping through all of the commands, the aliases are also added to the commands array, and for the command list a separate array which just has the commands but contains the aliases and help text.
- The aliases are shown with the help text in the command list, so for
hello-world, the text could be [hw, hello] Example hello world command. the aliases are shown in the square brackets.
What I'm not sure about: What do we do if there's a conflict between an alias and an existing command, should the alias override the command, or should the command override the alias?
We may want to provide support for creating aliases for commands. For example we could alias the
hello-worldexample command tohworhello.One way to approach this could be:
.alias.txtfile, which contains their aliases.cli.shas we loop through each command, we check if there is a.alias.txtfile, and store the aliases from that file.cli.shso that as it's looping through all of the commands, the aliases are also added to thecommandsarray, and for the command list a separate array which just has the commands but contains the aliases and help text.hello-world, the text could be[hw, hello] Example hello world command.the aliases are shown in the square brackets.What I'm not sure about: What do we do if there's a conflict between an alias and an existing command, should the alias override the command, or should the command override the alias?