lib/warp/dir/command/help.rb in warp-dir-1.1.1 vs lib/warp/dir/command/help.rb in warp-dir-1.1.2
- old
+ new
@@ -5,30 +5,39 @@
aliases :wtf
def run(opts, flags = [])
commander = ::Warp::Dir.commander
+ cmd = self
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 cmd.commands_needing_points(commander, needing_point: true)
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 cmd.commands_needing_points(commander, needing_point: false)
message EXAMPLES
message INSTALLATION
message opts.to_s
end
end
+ 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
+
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
@@ -45,11 +54,11 @@
if ::Warp::Dir::Command::Install.wrapper_installed?
INSTALLATION = <<EOF
#{'Installation'.bold.green}
- It appears that you already have a wrapper installed in one of your
- shell init files (#{::Warp::Dir::DOTFILES.join(', ')}
+ It appears that you already have a wrapper installed in one of the default
+ shell init files (#{::Warp::Dir::DOTFILES.join(', ')}).
Which means that 'wd' should be working on your system. If not, edit your
shell init file, remove any lines related to warp-dir gem, and then reinstall:
#{'wd install [ --dotfile <filename> ]'.bold.green}