Sha256: d5ca49c7262e490166aad944a40ef8029559663cbdf5874815b6c5542efc49c2

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

#!/usr/bin/env ruby

require 'commander/import'
require 'kryo'

program :name, 'kryo'
program :version, Kryo::VERSION
program :description, 'Kryo is a static blog generator'

default_command :help

command :new do |c|
  c.syntax = 'kryo new <name>'
  c.description = 'Builds a new kryo application'

  c.action do |args, options|
    raise ArgumentError.new("'name' is required") if args.empty?
    name = args[0]
    Kryo::Generators::SiteGenerator.invoke(name)
  end
end

command :generate do |c|
  c.syntax = "kryo generate [options]"
  c.description = "Generates something"

  c.action do |args, options|
    raise ArgumentError.new("you need to specify a generator") if args.empty?

    case args[0]
    when 'post'
      raise ArgumentError.new("you need to specify a title for the post") if args.count < 2
      title = args[1..-1].join(' ')
      Kryo::Generators::PostGenerator.invoke(title)
    else
      raise ArgumentError.new("#{args[0]} generator doesn't exist")
    end

  end
end
alias_command :g, :generate

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kryo-0.0.2 bin/kryo