Skip to content

Instantly share code, notes, and snippets.

@adamluzsi
Last active April 4, 2016 14:12
Show Gist options
  • Save adamluzsi/0db47d33e0af26c04c6de2245aa830c6 to your computer and use it in GitHub Desktop.
Save adamluzsi/0db47d33e0af26c04c6de2245aa830c6 to your computer and use it in GitHub Desktop.
Rack::App CLI example command decleration
require 'rack/app'
class App < Rack::App
cli do
command :test do
description "it's a sample test cli command"
option '-c', '--content [STRING]', 'add content to test file the following string' do |string|
options[:append]= string
end
action do |file_path|
options[:append] ||= 'default'
$stdout.puts options[:append],file_path
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment