Class: Tweemux::Action::Help

Inherits:
Tweemux::Action show all
Defined in:
lib/tweemux/action/help.rb

Instance Method Summary collapse

Methods inherited from Tweemux::Action

#call, colorize_tmux_command, explain, #explained_run, explained_run, #explained_run_as, explained_run_as, highlight_command, highlight_explanation, #initialize, load_all!, pseudo_restarts, system_or_raise, tmux_S, #tmux_S

Constructor Details

This class inherits a constructor from Tweemux::Action

Instance Method Details

#run(_) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/tweemux/action/help.rb', line 2

def run _
  five_dirs_up = (['..']*5).join '/'
  readme_path =
    File.expand_path 'lib/tweemux/action/help.rb'+five_dirs_up+'/README.md'
  contents = File.read readme_path
  contents.sub! /^.+(?=## Guest Usage)/m, ''
  contents.sub! /## Going Further.*/m, ''
  contents.sub! /For starters.+?gem install tweemux\n\n/mi, ''
  contents.gsub! /^## (.+)/ do |m| m.color :heading end
  contents.gsub! /^    .+/ do |m| m.color :command end
  warn contents
end