Created
January 23, 2014 05:51
-
-
Save jakenotjacob/8573593 to your computer and use it in GitHub Desktop.
Error when passing in ARGV values.
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
#!/usr/bin/env ruby | |
puts "Enter the tags for this post: " | |
tags = gets.chomp | |
date = Time.now.to_s.split(' ').first | |
args = ARGV | |
file_title = args.join("-") | |
post_title = args.join(" ") | |
File.open("#{date}-#{file_title}.md", "w") {|post| | |
post.write(" | |
---\n | |
layout: post\n | |
title: #{post_title}\n | |
tags: #{tags} | |
---\n | |
") | |
} | |
#$ ./make.rb asdf asdf | |
#Enter the tags for this post: | |
#./make.rb:6:in `gets': No such file or directory @ rb_sysopen - asdf (Errno::ENOENT)# | |
# from ./make.rb:6:in `gets' | |
# from ./make.rb:6:in `<main>' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay... Damn interesting. https://stackoverflow.com/questions/6965885/ruby-readline-fails-if-process-started-with-arguments