Sha256: 10bc4c17e1798cb9289e13eb504b48c8a44a374e41a9ffaef861787c9a7e452d

Contents?: true

Size: 512 Bytes

Versions: 2

Compression:

Stored size: 512 Bytes

Contents

#!/usr/bin/env ruby

$LOAD_PATH << File.dirname(__FILE__) + "/../lib" if $0 == __FILE__

require "jok"
require "thor"

class JokAtWork < Thor
  desc "list", "To show all the available joke list"
  def list
    puts Jok.list
  end

  desc "da", "Randomly get a joke"
  def da
    puts Jok.da
  end

  desc "topic [YOUR_TOPIC]", "Pick up a specified topic"
  def topic(topic)
    if Jok.feed.method_list.include? topic
      puts Jok.send(topic)
    else
      puts Jok.da
    end
  end
end

JokAtWork.start(ARGV)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jok-0.0.3 bin/jok
jok-0.0.1 bin/jok