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

Version Path
jekyll-3.5.2 lib/jekyll/commands/help.rb
jekyll-3.5.1 lib/jekyll/commands/help.rb
jekyll-3.4.5 lib/jekyll/commands/help.rb
jekyll-3.5.0 lib/jekyll/commands/help.rb
jekyll-3.4.4 lib/jekyll/commands/help.rb
jekyll-3.4.3 lib/jekyll/commands/help.rb
jekyll-3.4.2 lib/jekyll/commands/help.rb
jekyll-3.4.1 lib/jekyll/commands/help.rb
jekyll-3.4.0 lib/jekyll/commands/help.rb
jekyll-3.3.1 lib/jekyll/commands/help.rb
jekyll-3.3.0 lib/jekyll/commands/help.rb
jekyll-3.3.0.pre.rc1 lib/jekyll/commands/help.rb
jekyll-3.2.1 lib/jekyll/commands/help.rb
jekyll-3.2.0 lib/jekyll/commands/help.rb
jekyll-3.2.0.pre.beta2 lib/jekyll/commands/help.rb
jekyll-3.2.0.pre.beta1 lib/jekyll/commands/help.rb