From 939c67222a5739eb435399a03de8374f791e3c93 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 6 Aug 2014 21:28:21 -0400 Subject: [PATCH] Check to make sure the command is valid. --- lib/jekyll/commands/help.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/commands/help.rb b/lib/jekyll/commands/help.rb index b9e79f22..421d87e5 100644 --- a/lib/jekyll/commands/help.rb +++ b/lib/jekyll/commands/help.rb @@ -9,15 +9,24 @@ module Jekyll c.description 'Show the help message, optionally for a given subcommand.' c.action do |args, _| + cmd = (args.first || "").to_sym if args.empty? puts prog + elsif prog.has_command? cmd + puts prog.commands[cmd] else - puts prog.commands[args.first.to_sym] + invalid_command(prog, cmd) + abort end end end end + def invalid_command(prog, cmd) + Jekyll.logger.error "Error:", "Hmm... we don't know what the '#{cmd}' command is." + Jekyll.logger.info "Valid commands:", prog.commands.keys.join(", ") + end + end end end