Hopefully we have piqued your interesting into using CommandBox to help you with your day to day development, but maybe you haven't had much experience with a CLI. I wanted to share a few tips and tricks to make your life easier.
Tab Completion
One of the most productive features of the shell is tab completion. This means you can type a partial command and hit the tab key on your keyboard to be prompted with suggestions that match what you've typed so far. If there is only one match, it will be finished for you. This can save a lot of typing and will be a familiar concept to those already living in a CLI environment.
When "tab" is pressed, the text you've entered so far is run through the CommandBox command parser to see if it can match a namespace, command, or parameters. If you press tab at an empty prompt, all top level commands and namespaces will display. Since tab completion is run through the standard command parser, that means it works on command aliases as well.
CommandBox> cold
Chaining Commands
Use a pipe (|
) to pass the output of one command into another command as its first input. Output can be piped between more than one command.
cat myLogFile.txt | grep "variable .* undefined"
Output
Output from commands will be ANSI-formatted text which, by default, streams directly to the console. When in the interactive shell, you can capture the output of commands and manipulate it, search it, or write it to a file. Use a right bracket (>
) and double right bracket (>>
) to redirect output to the file system.
dir > fileList.txt
echo "Step 3 complete" >> log.txt
Hopefully these help you get even more out of the CLI and CommandBox.
Add Your Comment