Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (24 sloc) 879 Bytes
#!/usr/bin/env ruby
require 'rubygems'
require 'lorem'
PASTE_MODIFIER = '-p'
args = ARGV.any? { |a| a == PASTE_MODIFIER } ? ARGV.reject { |a| a == PASTE_MODIFIER } : ARGV.dup
number = args.shift || 1
type = args.shift || :paragraphs
output = Lorem::Base.new(type, number).output
if ARGV[-1] == PASTE_MODIFIER
system("lorem #{number} #{type} | pbcopy")
puts "Just pasted your request to the clipboard. (only works on osx)"
else
puts output
if number == 1 && type == :paragraphs
puts
puts "Usage: lorem [number] [type] (ie: lorem 5 paragraphs)"
puts " - Number defaults to 1 if no parameters given"
puts " - Type defaults to paragraphs"
puts " - If you are on mac osx you can add -p as an argument and it will auto paste to your clipboard."
puts " - Available Types:"
Lorem::Base::TYPES.each { |t| puts " - #{t}" }
puts
end
end