Module: Watson
- Included in:
- Command, Config, FS, Parser, Printer, Printer, Remote, Remote::Bitbucket, Remote::GitHub
- Defined in:
- lib/watson.rb,
lib/watson/fs.rb,
lib/watson/config.rb,
lib/watson/github.rb,
lib/watson/parser.rb,
lib/watson/remote.rb,
lib/watson/command.rb,
lib/watson/printer.rb,
lib/watson/version.rb,
lib/watson/bitbucket.rb
Defined Under Namespace
Classes: Command, Config, FS, Parser, Printer, Remote
Constant Summary collapse
- GLOBAL_DEBUG_ON =
Global flag to turn ON debugging across all files
false- GLOBAL_DEBUG_OFF =
Gllobal flag to turn OFF debugging across all files
false- BOLD =
Color definitions for pretty printing Defined here because we need Global scope but makes sense to have them in the printer.rb file at least
"\e[01m"- UNDERLINE =
"\e[4m"- RESET =
"\e[00m"- GRAY =
"\e[38;5;0m"- RED =
"\e[38;5;1m"- GREEN =
"\e[38;5;2m"- YELLOW =
"\e[38;5;3m"- BLUE =
"\e[38;5;4m"- MAGENTA =
"\e[38;5;5m"- CYAN =
"\e[38;5;6m"- WHITE =
"\e[38;5;7m"- VERSION =
"1.1.1"
Class Method Summary collapse
-
.check_less ⇒ Object
Perform system check to see if we are able to use unix less for printing.
-
.debug_print(msg) ⇒ Object
Global debug print that prints based on local file DEBUG flag as well as GLOBAL debug flag.
Class Method Details
.check_less ⇒ Object
Perform system check to see if we are able to use unix less for printing
63 64 65 66 67 |
# File 'lib/watson.rb', line 63 def check_less # Check if system has less (so we can print out to it to allow scrolling) # [todo] - Implement this scrolling thing inside watson with ncurses return system("which less > /dev/null 2>&1") end |
.debug_print(msg) ⇒ Object
Global debug print that prints based on local file DEBUG flag as well as GLOBAL debug flag
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/watson.rb', line 45 def debug_print(msg) # [todo] - If input msg is a Hash, use pp to dump it # Print only if DEBUG flag of calling class is true OR # GLOBAL_DEBUG_ON of Watson module (defined above) is true # AND GLOBAL_DEBUG_OFF of Watson module (Defined above) is false # Sometimes we call debug_print from a static method (class << self) # and other times from a class method, and ::DEBUG is accessed differently # from a class vs object, so lets take care of that _DEBUG = (self.is_a? Class) ? self::DEBUG : self.class::DEBUG print "=> #{msg}" if ( (_DEBUG == true || GLOBAL_DEBUG_ON == true) && (GLOBAL_DEBUG_OFF == false)) end |