Module | Bat |
In: |
lib/bat.rb
|
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.