Skip to content

Instantly share code, notes, and snippets.

@carlesso
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlesso/905c7332c7074d76ea92 to your computer and use it in GitHub Desktop.
Save carlesso/905c7332c7074d76ea92 to your computer and use it in GitHub Desktop.
Pry::Commands.create_command 'echo' do
description 'Echo the input'
banner <<-BANNER
Usage: echo [ -j <joiner> ] <words>
BANNER
def setup
@joiner = ' '
end
def options(opt)
opt.on :j, :joiner=, "Joins using", true do |c|
@joiner = c
end
end
def process
output.puts args.join(@joiner)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment