Last active
April 4, 2016 14:12
-
-
Save adamluzsi/0db47d33e0af26c04c6de2245aa830c6 to your computer and use it in GitHub Desktop.
Rack::App CLI example command decleration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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