Convenience module for subcommand registration syntax sugar.
Extension callback – register the extending object as a subcommand.
# File lib/assemblage/cli.rb, line 247
def self::extended( mod )
        Assemblage::CLI.log.debug "Registering subcommands from %p" % [ mod ]
        Assemblage::CLI.register_subcommands( mod )
end
						Output a table with the given header (an array) and
rows (an array of arrays).
# File lib/assemblage/cli.rb, line 310
def display_table( header, rows )
        table = TTY::Table.new( header, rows )
        renderer = nil
        if hl.enabled?
                renderer = TTY::Table::Renderer::Unicode.new(
                        table,
                        multiline: true,
                        padding: [0,1,0,1]
                )
                renderer.border.style = :dim
        else
                renderer = TTY::Table::Renderer::ASCII.new(
                        table,
                        multiline: true,
                        padding: [0,1,0,1]
                )
        end
        puts renderer.render
end
						Return the specified string in the 'error' ANSI color.
# File lib/assemblage/cli.rb, line 303
def error_string( string )
        return hl.error( string )
end
						Exit with the specified exit_code after printing the given
message.
# File lib/assemblage/cli.rb, line 258
def exit_now!( message, exit_code=1 )
        raise GLI::CustomExit.new( message, exit_code )
end
						Return the specified string in the 'headline' ANSI
color.
# File lib/assemblage/cli.rb, line 285
def headline_string( string )
        return hl.headline( string )
end
						Exit with a helpful message and display the usage.
# File lib/assemblage/cli.rb, line 264
def help_now!( message=nil )
        exception = OptionParser::ParseError.new( message )
        def exception.exit_code; 64; end
        raise exception
end
						Return the specified string in the 'highlight' ANSI
color.
# File lib/assemblage/cli.rb, line 291
def highlight_string( string )
        return hl.highlight( string )
end
						Return the global Pastel object for convenient formatting, color, etc.
# File lib/assemblage/cli.rb, line 279
def hl
        return Assemblage::CLI.pastel
end
						Get the prompt (a TTY::Prompt object)
# File lib/assemblage/cli.rb, line 273
def prompt
        return Assemblage::CLI.prompt
end
						Return the specified string in the 'success' ANSI
color.
# File lib/assemblage/cli.rb, line 297
def success_string( string )
        return hl.success( string )
end
						In dry-run mode, output the description instead of running the provided
block and return the return_value. If dry-run mode is not
enabled, yield to the block.
# File lib/assemblage/cli.rb, line 343
def unless_dryrun( description, return_value=true )
        if $DRYRUN
                self.log.warn( "DRYRUN> #{description}" )
                return return_value
        else
                return yield
        end
end
						Return the count of visible (i.e., non-control) characters in the given
string.
# File lib/assemblage/cli.rb, line 335
def visible_chars( string )
        return string.to_s.gsub(/\e\[.*?m/, '').scan( /\P{Cntrl}/ ).size
end