class RBT::BeautifyConfigureHelpOutput
Constants
- R
#¶ ↑
R
¶ ↑#¶ ↑
- RUN_THIS_COMMAND
#¶ ↑
RUN_THIS_COMMAND
¶ ↑This is the command we run to get some help.
#¶ ↑
Public Class Methods
Public Instance Methods
colourize_this(i)
click to toggle source
#¶ ↑
colourize_this
(colourize tag)¶ ↑
This method will colourize some words.
#¶ ↑
# File lib/rbt/utility_scripts/beautify_configure_help_output.rb, line 110 def colourize_this(i) if i.include? 'DATAROOTDIR' i.gsub!(/(DATAROOTDIR)/, slateblue('\1')+green) end if i.include? 'EPREFIX' i.gsub!(/(EPREFIX)/, orange('\1')+green) elsif i.include? 'PREFIX' i.gsub!(/(PREFIX)/, orchid('\1')+green) end if i.include? 'SUFFIX' i.gsub!(/(SUFFIX)/, powderblue('\1')+green) end return i end
determine_result()
click to toggle source
#¶ ↑
determine_result
¶ ↑
@result will keep the result from running a sys-command.
#¶ ↑
# File lib/rbt/utility_scripts/beautify_configure_help_output.rb, line 96 def determine_result begin @result = `#{RUN_THIS_COMMAND}`.split("\n").map {|entry| entry.chomp.strip } reformat_result_string rescue Errno::ENOENT; end end
find_all_entries_with( i = '--' )
click to toggle source
green()
click to toggle source
reformat_result_string()
click to toggle source
report_result()
click to toggle source
#¶ ↑
report_result
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/beautify_configure_help_output.rb, line 128 def report_result n_options = @result.size opne 'These ('+simp(n_options.to_s)+') options are available '+ 'for '+simp(File.basename(return_pwd))+':' e n_ljust = 38 l_padding = ' '.dup # Left padding. if @result.is_a? Array cliner { @result.sort.each {|entry| if entry.include? ' ' splitted = entry.split(' ').reject {|inner_entry| inner_entry.empty? } splitted.map! {|inner_entry| inner_entry.tr(R,'').tr(T,'') } # We have a little leading ' ' padding. splitted[0] = l_padding+(splitted[0].ljust(n_ljust))+green splitted[-1] = colourize_this(splitted[-1]) splitted[-1] = splitted[-1].strip.ljust(40)+rev entry = splitted.join(' ') else # Else we have to pad too. entry = l_padding+entry.ljust(n_ljust) end efancy " #{entry}" } } end e end
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/utility_scripts/beautify_configure_help_output.rb, line 46 def reset super() infer_the_namespace # ======================================================================= # # === @result # ======================================================================= # @result = nil end
result?()
click to toggle source