Class: Warp::Dir::Command::Help
- Inherits:
-
Warp::Dir::Command
- Object
- Warp::Dir::Command
- Warp::Dir::Command::Help
- Defined in:
- lib/warp/dir/command/help.rb
Constant Summary collapse
- USAGE =
"\n\#{\"Usage:\".bold.green} wd [ --command ] [ list | help ] [ wd-flags ]\n wd [ --command ] [ [ warp ] | add [-f] | rm | ls ] [ wd flags ] <point> -- [ cmd-flags ]\n wd --help | help\n"- EXAMPLES =
"\n\#{'Examples'.bold.green}\n wd add proj # add current directory as a warp point\n wd ~/ # wd works just like 'cd' for regular folders\n wd proj # jumps to proj\n wd list # lists all 'bookmarked' points\n wd rm proj # removes proj\n"- INSTALLATION =
"\n\#{'Installation'.bold.green}\n In order for you to start warping all around, you must install the shell wrapper which\n calls into the ruby to do the job. Shell wrapper function is required in order to\n change directory in the outer shell (parent process). Do not worry about this if you\n do not understand it, but please run this command:\n\n \#{'wd install [ --dotfile <filename> ]'.bold.green}\n\n This command will ensure you have the wrapper installed in your ~/.bashrc or ~/.zshrc\n files. Once installed, just restart your shell!\n\n If you experience any problem, please log an issue at:\n https://github.com/kigster/warp-dir/issues\n"
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
#commands_needing_points(commander, needing_point: true) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/warp/dir/command/help.rb', line 26 def commands_needing_points(commander, needing_point: true) help = '' commander. commands. select{|cmd| needing_point ? cmd.needs_a_point? : !cmd.needs_a_point? }. map(&:command_name).each do |installed_commands| help << sprintf(" %s\n", commander.find(installed_commands).help) end help end |
#run(opts, flags = []) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/warp/dir/command/help.rb', line 7 def run(opts, flags = []) commander = ::Warp::Dir.commander cmd = self on :success do USAGE ' ' 'Warp Point Commands:'.bold.green ' ' cmd.commands_needing_points(commander, needing_point: true) ' ' 'Global Commands:'.bold.green ' ' cmd.commands_needing_points(commander, needing_point: false) EXAMPLES INSTALLATION opts.to_s end end |