Sha256: 0fc3580ab223b2111dfc6ab45f57aff9b69fb8393855ac60dd390bc41529b5e2
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true 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? Jekyll.logger.info prog.to_s elsif prog.has_command? cmd Jekyll.logger.info prog.commands[cmd].to_s 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
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
jekyll-4.2.1 | lib/jekyll/commands/help.rb |
ngage-0.0.0 | lib/ngage/jekyll/commands/help.rb |