Sha256: 36e76042fdada041e028e3ded20f6bcbcd5a5a66cbf4e9e677cc9271cb43f65d

Contents?: true

Size: 891 Bytes

Versions: 15

Compression:

Stored size: 891 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

15 entries across 15 versions & 3 rubygems

Version Path
blackboard-3.1.9 lib/jekyll/commands/help.rb
blackboard-3.1.8 lib/jekyll/commands/help.rb
blackboard-3.1.7 lib/jekyll/commands/help.rb
jekyll-3.1.6 lib/jekyll/commands/help.rb
jekyll-3.1.5 lib/jekyll/commands/help.rb
jekyll-3.1.4 lib/jekyll/commands/help.rb
jekyll-3.1.3 lib/jekyll/commands/help.rb
jekyll-3.1.2 lib/jekyll/commands/help.rb
jekyllplusadmin-1.1.0 lib/jekyll/commands/help.rb
jekyllplusadmin-1.0.0 lib/jekyll/commands/help.rb
jekyll-3.1.1 lib/jekyll/commands/help.rb
jekyll-3.1.0 lib/jekyll/commands/help.rb
jekyll-3.1.0.pre.rc3 lib/jekyll/commands/help.rb
jekyll-3.1.0.pre.rc2 lib/jekyll/commands/help.rb
jekyll-3.1.0.pre.rc1 lib/jekyll/commands/help.rb