Ad-hoc Command Aliases
Do you ever get tired of typing some built in commands and you'd like to just alias them as something simpler? You can create arbitrary alises now that reduce the amount of typing you do.
1
config set command.aliases.cca="coldbox create app"
2
cca myApp
Copied!
In the above example, it's the same thing as typing coldbox create app myApp.
Aliases are treated as in-place shell expansions so you can alias anything including default parameters as well as multiple commands chained together.
1
config set command.aliases.foobar="echo brad | grep brad | sed s/rad/foo/ > foo.txt && cat foo.txt"
2
foobar
Copied!
In the above example, typing foobar is the same as running the giant command string that's being set into the alias.
If you create an alias that matches an existing command name, your alias will take precedence since aliases are expanded before commands are resolved.
Here we can change the name of a common command like echo that we really wish had been named print.
1
config set command.aliases.print=echo
2
print brad
Copied!
Let's take it a step further and alias the alias!
1
config set command.aliases.cout=print
2
cout brad
Copied!
Running cout brad is the same as running print brad which is the same as running echo brad. Try not to get dizzy when doing this, please.
Copy link