Module Bat
In: lib/bat.rb

Methods

err   exitchecker   pt   synopsis   wrn  

Classes and Modules

Class Bat::Optparser

Public Instance methods

Wrapper around Bat::pt. It will add the word ERROR to the output. And exit with code 1.

Evaluates error code and puts a string as warning (using wrn) if keeprunning is true and code != 0. If keeprunning is false it calls err.

Wrapper around IO#puts. It will add custom formating to ensure batmessages are more visible than regular terminal output. It expects @batpart to be set. Thus you can influence it at runtime, eventually this will change to harddetection of the part using the script name.

    pt("Reading your emails")               #=> .!!!~~~~>Bat batget: Reading your emails
    pt("Reading your emails", " seriously") #=> .!!!~~~~>Bat batget seriously: Reading your emails

Output script synopsis. mandatory contains a comma seperated list of mandatory arguments, while optional contains a comma seperated list of optional arguments.

    synopsis("PACKAGENAME,PATH")       #=> ./batget.rb PACKAGENAME|PATH
    synopsis("PATH","download,upload") #=> ./batget.rb PATH [download|upload]
    synopsis(,"download,upload")       #=> ./batget.rb [download|upload]

Bat::Optparser provides a more powerful implementation of option parsing, in a lot of cases you would only need a simple approach however. For example when you only parse one argument anyway.

Wrapper around Bat::pt. It will add the word WARNING to the output.

[Validate]