Created
August 28, 2013 21:02
-
-
Save ryancastro/6371228 to your computer and use it in GitHub Desktop.
Just a little reminder on an interesting way to split command line arguments via commas.
This file contains hidden or 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
def stuff(things) | |
things.each do |command| | |
puts "I am executing this command: #{command.strip}\n" | |
end | |
end | |
stuff(ARGV.join(" ").split(",")) | |
# cmd: test argument1, argument2, argument 3 things, argument 4 | |
# I am executing this command: argument1 | |
# I am executing this command: argument2 | |
# I am executing this command: argument 3 things | |
# I am executing this command: argument 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment