Skip to content

Latest commit

 

History

History

colors

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Colors Example

This example demonstrates how to add color print functions.

This example was generated with:

$ bashly init
# ... now edit src/bashly.yml to match the example ...
$ bashly add colors
$ bashly generate
# ... now edit src/root_command.sh ...
$ bashly generate

The bashly add colors command, simply created the src/lib/colors.sh file, with useful color functions that will be automatically included in the generated script.

See the manually edited src/root_command.sh for usage examples.


bashly.yml

name: colorly
help: Sample application that uses the color functions
version: 0.1.0

args:
- name: message
  help: "Message to show [default: hello colors]"

src/root_command.sh

message=${args[message]:-hello colors}

underlined "Message Received":
echo
echo "  => $(green_bold "$message")"
echo "  ==> $(red_bold "$message")"
echo "  ===> $(blue_bold "$message")"
echo

Output

$ ./colorly

Message Received:

  => hello colors
  ==> hello colors
  ===> hello colors


$ NO_COLOR=1 ./colorly

Message Received:

  => hello colors
  ==> hello colors
  ===> hello colors