Skip to content

Instantly share code, notes, and snippets.

@danott
Created December 16, 2011 23:06
Show Gist options
  • Save danott/1488435 to your computer and use it in GitHub Desktop.
Save danott/1488435 to your computer and use it in GitHub Desktop.
Ruby Command Line Utility Boilerplate
#!/usr/local/bin/ruby
puts "Running application"
class App
def initialize(args)
end
def action(input)
"input was #{input}"
end
end
app = App.new(ARGV[0] || 'Default')
while(true)
print 'input> '
input = gets.strip
unless input==""
exit if input=="exit" || input=="quit"
puts app.action(input)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment