Sha256: 869b357243d0b96ece26ba0094088b2f3c2eb528f0aedb7d6f11ac095c449c5a

Contents?: true

Size: 741 Bytes

Versions: 8

Compression:

Stored size: 741 Bytes

Contents

# encoding: utf-8

name        'help'
usage       'help [command_name]'
summary     'show help'
description <<-EOS
Show help for the given command, or show general help. When no command is
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, cmd|
  if cmd.supercommand.nil?
    raise NoHelpAvailableError,
      "No help available because the help command has no supercommand"
  end

  if args.empty?
    puts cmd.supercommand.help
  elsif args.size == 1
    puts cmd.supercommand.command_named(args[0]).help
  else
    $stderr.puts cmd.usage
    exit 1
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cri-2.2.1 lib/cri/commands/basic_help.rb
cri-2.2.0 lib/cri/commands/basic_help.rb
cri-2.1.0 lib/cri/commands/basic_help.rb
cri-2.0.2 lib/cri/commands/basic_help.rb
cri-2.0.1 lib/cri/commands/basic_help.rb
cri-2.0.0 lib/cri/commands/basic_help.rb
cri-2.0rc1 lib/cri/commands/basic_help.rb
cri-2.0b1 lib/cri/commands/basic_help.rb