Bash Utility

General

opal:bash_intro

Write the file header bash comment to the top of a bash file.

This is best used in a script for creating new files. The header writes three values to the file header - the Generator, Date-Created, and Author. The Generator is the application creating the file. The Date-Created reports the time the date and time the file was created, in the opal-datetime format. The author is the username who ran the functions, which created the file.

@param String $filename

@output void
$ opal:bash_intro ~/.bashrc

The output is written to the filename passed. Here’s an example of the output.

#
# Generator: Opal <https://github.com/andrewwoods/opal>
# Date-Created: 2026 Apr 19 Sun 11:49
# Author: your_username
#

opal:vim_intro

Write the file header Vim comment to the top of a Vim file.

This is best used in a script for creating new files. The header writes three values to the file header - the Generator, Date-Created, and Author. The Generator is the application creating the file. The Date-Created reports the time the date and time the file was created, in the opal-datetime format. The author is the username who ran the functions, which created the file.

@param String $filename

@output void
$ opal:bash_intro ~/.vimrc

The output is written to the filename passed. Here’s an example of the output.

"
" Generator: Opal <https://github.com/andrewwoods/opal>
" Date-Created: 2026 Apr 19 Sun 11:49
" Author: your_username
"

opal:bash_heading_box

Write the section heading box to a file

This utility for creating a section header is best used in a script for creating new files.

@param String $heading

@param String $filename

@output void
$ opal:bash_heading_box 'My Heading' ~/.bashrc

opal:preamble

Display the system preamble

Show the user some information to greet them when opening a new terminal.

@output String
$ opal:preamble

opal:up

Navigate up the file system a number of directories. Default 1.

Often you want to travel up a numnber of directory levels.

~/src/public/opal-documentation-rtd $ opal:up 2

~/src/ $

opal:type_file

Dynamically display a text file.

An animated version of echo. Gives the sense of typing the file text to STDOUT.

@uses bin/typer
$ opal:type_file filename.txt

opal:type_line

Dynamically display a line of text.

An animated version of echo. Gives the sense of typing the text to STDOUT.

@uses bin/typer
$ opal:type_line "Hello World"

opal:spacer

Create a number of blank lines. By default, creates a single blank line.

Sometime you need to create vertical white space.

@param Integer $quantity
The number of blank lines to create. Default = 1.

@output string
$ opal:spacer 4

User Experience

opal:country

Lookup a country name for a given 2-letter or 3-letter country code.

$ opal:country ca
Looking up CA ...
CANADA

opal:define

Lookup the definitions for an English word using dict.org

$ opal:define computer

opal:say_done

Use Mac’s say command to convert simple message to sound.

By default, the message will say “It is Done!”. This is useful when completing a long running command, and you don’t want to stare at your terminal.

$ opal:say_done

$ opal:say_done "The script has completed"

opal:show_dotfiles

Allow you to turn on and off the display of hidden files in Apples Finder.

Note: This doesn’t affect the ls command.

@param String $choice
Can be on, off, true, or false

@output void
$ opal:show_dotfiles yes

$ opal:show_dotfiles no