Class: JekyllCommandTemplate

Inherits:
Jekyll::Command
  • Object
show all
Defined in:
jekyll_command_template.rb

Overview

Template for Jekyll command plugins. Once you create a command plugin from this template, mention it in a Gemfile group called :jekyll_plugins, like this: group :jekyll_plugins do gem "my_command_template" end

See Also:

Author:

License:

  • SPDX-License-Identifier: Apache-2.0

Class Method Summary collapse

Class Method Details

.init_with_program(prog) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'jekyll_command_template.rb', line 18

def init_with_program(prog)
  @log.info "prog [#{prog.class}] = #{prog}".green
  prog.command(:new) do |c|
    c.syntax 'new [options]'
    c.description 'Create a new Jekyll site.'
    c.option 'dest', '-d DEST', 'Where the site should go.'

    c.action do |args, options|
      @log.info "args [#{args.class}] = #{args}".green
      @log.info "options [#{options.class}] = #{options}".green
      Jekyll::Site.new_site_at(options['dest'])
    end
  end
end