lib/cri/commands/basic_help.rb in cri-2.0a3 vs lib/cri/commands/basic_help.rb in cri-2.0b1

- old
+ new

@@ -8,15 +8,20 @@ given, a list of available commands is displayed, as well as a list of global commandline options. When a command is given, a command description as well as command-specific commandline options are shown. EOS -run do |opts, args| +run do |opts, args, cmd| + if cmd.supercommand.nil? + raise NoHelpAvailableError, + "No help available because the help command has no supercommand" + end + if args.empty? - puts self.supercommand.help + puts cmd.supercommand.help elsif args.size == 1 - puts self.supercommand.command_named(args[0]).help + puts cmd.supercommand.command_named(args[0]).help else - $stderr.puts self.usage + $stderr.puts cmd.usage exit 1 end end