Class: Warp::Dir::Command::Help

Inherits:
Warp::Dir::Command show all
Defined in:
lib/warp/dir/command/help.rb

Constant Summary collapse

USAGE =
<<EOF
#{"Usage:".bold.green}  wd [ --command ] [ list | help ] [ wd-flags ]
        wd [ --command ] [ [ warp ] | add  [-f] | rm | ls ] [ wd flags ] <point> -- [ cmd-flags ]
        wd --help | help
EOF
EXAMPLES =
<<EOF

#{'Examples'.bold.green}
       wd add proj    add current directory as a warp point
       cd ~/
       wd proj        jumps to proj
       wd list        lists all points
       wd rm proj     removes proj
EOF
INSTALLATION =
<<EOF

#{'Installation'.bold.green}
    In order for you to start warping all around, you must install the shell wrapper which
    calls into the ruby to do the job. Shell wrapper function is required in order to
    change directory in the outer shell (parent process). Do not worry about this if you
    do not understand it, but please run this command:

    #{'wd install [ --dotfile <filename> ]'.bold.green}

    This command will ensure you have the wrapper installed in your ~/.bashrc or ~/.zshrc
    files. Once installed, just restart your shell!

    If you experience any problem, please log an issue at:
    https://github.com/kigster/warp-dir/issues
EOF

Instance Attribute Summary

Attributes inherited from Warp::Dir::Command

#formatter, #point, #point_name, #point_path, #store

Instance Method Summary collapse

Methods inherited from Warp::Dir::Command

command_name, #config, help, inherited, #initialize, #inspect, installed_commands, #needs_point?, #on, #puts

Constructor Details

This class inherits a constructor from Warp::Dir::Command

Instance Method Details

#run(opts, flags = []) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/warp/dir/command/help.rb', line 8

def run(opts, flags = [])
  commander = ::Warp::Dir.commander
  on :success do
    message USAGE
    message ' '
    message 'Warp Point Commands:'.bold.green
    message ' '
    commander.commands.select{|cmd| cmd.needs_a_point?}.map(&:command_name).each do |installed_commands|
      message sprintf("  %s\n", commander.find(installed_commands).help)
    end
    message ' '
    message 'Global Commands:'.bold.green
    message ' '
    commander.commands.reject{|cmd| cmd.needs_a_point?}.map(&:command_name).each do |installed_commands|
      message sprintf("  %s\n", commander.find(installed_commands).help)
    end
    message EXAMPLES
    message INSTALLATION
    message opts.to_s
  end
end