aboutsummaryrefslogblamecommitdiffstats
path: root/cowsay/cowsay.lua
blob: a596e965d6db850c4e3197027096d6ef8b784e32 (plain) (tree)
1
2
3
              
                                                                                
             















                                         
                                                                                











                                                       
                                                                                












                                                        
                                                                                







































                                                                                








































                                                                                


                                               



                                                

                                                        





                                                

           
#!/usr/bin/lua
--------------------------------------------------------------------------------
-- my drawing
function ascii_nerd( name )
	local s = ""
	s = s .. [[

\ | | /
| o o |
 \ O /
  | |
]]
	local l = string.len(name)
	for i=1,l+4 do s = s .. "+" end
	s = s .. "\n| " .. name .. " |\n"
	for i=1,l+4 do s = s .. "+" end
	return s
end

--------------------------------------------------------------------------------
--from beej.us
function ascii_goat( text )
	local s = ""
	s = s .. [[    )_)
 ___|oo) ]]
	s = s .. text .. "\n"
	s = s .. [['|  |\_|                            
 |||| #
 ````]]
	return s
end

--------------------------------------------------------------------------------
--http://ascii.co.uk/art/shoot
function ascii_shoot( name )
	local s = ""
	if name == nil then name = "" else
	name = "("..name..")" end
	s = s .. [[
   O
  <\==-   -   - -   -  -  - ---
 ./ \                            _/\_\O ]] .. name .. [[
]]
	return s
end

--------------------------------------------------------------------------------
--http://ascii.co.uk/art/juice
function ascii_juice( name1, name2 )
	local s = ""
	if name1 == nil then name1 = "" end
	if name2 == nil then name2 = "" end
	local l1 = string.len( name1 )
	local l2 = string.len( name2 )

	if l1 > 5 then 
		name1 = string.sub( name1, 1, 5 )
	elseif l1 < 5 then
		while string.len(name1) < 5 do
			name1 = name1 .. ' '
		end
	end

	if l2 > 5 then
		name2 = string.sub( name2, 1, 5 )
	elseif l2 < 5 then
		while string.len( name2 ) < 5 do
			name2 = name2 .. ' '
		end
	end

	s = s .. [[
             __
            /.-
    ______ //
   /______'/|
   [       ]|
   [ ]] .. name1 .. [[ ]|
   [ ]] .. name2 .. [[ ]|
   [  _\_  ]|
   [  :::  ]|
   [   :'  ]/
   '-------']]
   return s
end

--------------------------------------------------------------------------------
-- http://ascii.co.uk/art/coffee
function ascii_coffee( name )
	local s = ""
	if name == nil then name = "Single Expresso" end
	if name ~= nil then name = "Single Expresso for " .. name end

s = s .. [[  .-=-.
 ,|`~'|
 `|   |  ]] .. name .. [[ 
   `~']]

   	return s
end
--------------------------------------------------------------------------------
--http://ascii.co.uk/art/pool
function ascii_pool( name )
	local s = ""
	if name == nil then name = "" end

s = s .. [[,_____,_____,    6 __
T\  :.      .^\,_/_\_I_     ]] .. name .. [[ 
I ^T=====;=====T   /|   
   I           I _|_|]]

   	return s
end
--------------------------------------------------------------------------------
--http://ascii.co.uk/art/cat
function ascii_cat( text )
	local s = ""
	if text == nil then text = "mmeeoowwrr!" end

s = s .. [[
    )   _. ]] .. text .. [[ 
   (___)''
   / ,_,/
  /'"\ )\]]
	return s
end           

--------------------------------------------------------------------------------
for k,v in ipairs(arg) do
	if v == "nerd" then
		print( ascii_nerd( arg[k+1] ) )
	elseif v == "goat" then
		print( ascii_goat( arg[k+1] ) )
	elseif v == "shoot" then
		print( ascii_shoot( arg[k+1] ) )
	elseif v == "juice" then
		print( ascii_juice( arg[k+1], arg[k+2]))
	elseif v == "coffee" then
		print( ascii_coffee( arg[k+1] ))
	elseif v == "pool" then
		print( ascii_pool( arg[k+1] ))
	elseif v == "cat" then
		print( ascii_cat( arg[k+1] ))
	end
end