Sha256: f39b092a2c964d9e51382b81cf1747c2a6b5c38139c90fac22478bf1e5eb3bb5
Contents?: true
Size: 907 Bytes
Versions: 16
Compression:
Stored size: 907 Bytes
Contents
module Jekyll module Commands class Help < Command class << self def init_with_program(prog) prog.command(:help) do |c| c.syntax "help [subcommand]" 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 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 end
Version data entries
16 entries across 16 versions & 1 rubygems