arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Example Project

hashtag
Example Project

Here is an example CommandBox module that uses an interceptor (in the ModuleConfig.cfc) and custom commands to help manage its settings.

On Forgebox:

https://www.forgebox.io/view/commandbox-banner-customizerarrow-up-right

On GitHub:

hashtag
CommandBox Banner Customizer

Ever gotten tired of the same lame ASCII art every time you start the CommandBox shell in interactive mode? Well fear not, this module is for you!

hashtag
Installation

Install the module like so:

Once you've done that, there are three module settings you can override to affect how the CLI starts up.

hashtag
Hide the banner

Now reload the CLI and the ASCII art is gone.

hashtag
Show the banner

Now reload the CLI and the ASCII art is back.

hashtag
Custom banner text

Now reload the CLI and your custom message will appear to greet you. Note this setting is ignored if the banner is off.

hashtag
Custom banner file

Want to get all kinds of funky and create your own ASCII art of your cat? Save the exact text you want to output (can be multiple lines) into a file and specify the file path here:

Note this setting is ignored if the banner is off or if banner text is set. For extra credit, try including ANSI escape codes in your text file for a color-coded banner

hashtag
Advanced

All these example commands do is set config settings for you. You can also control the module settings without the banner commands by directly setting the config settings like so:

You can see the current state of this modules settings at any time by using config show to print it out.

https://github.com/bdw429s/commandbox-banner-customizerarrow-up-right
CommandBox> install commandbox-banner-customizer
CommandBox> banner off
CommandBox> banner on
CommandBox> banner text "I like spam!"
CommandBox> banner file myCustomBanner.txt
CommandBox> config set modules.commandbox-banner-customizer.hidebanner=true
CommandBox> config set modules.commandbox-banner-customizer.bannertext="I like spam!"
CommandBox> config set modules.commandbox-banner-customizer.bannerfilepath="C:\\myCustomBanner.txt"
CommandBox> config show modules.commandbox-banner-customizer