Last active
September 15, 2015 07:08
-
-
Save lorentzca/dc2e9875033f965f7069 to your computer and use it in GitHub Desktop.
what quarter now
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
#!/usr/bin/env ruby | |
def what_quarter_now | |
month = Time.now.strftime("%-m") | |
if month == 6 || 7 || 8 | |
puts "1Q" | |
elsif month == 9 || 10 || 11 | |
puts "2Q" | |
elsif month == 12 || 1 || 2 | |
puts "3Q" | |
elsif month == 3 || 4 || 5 | |
puts "4Q" | |
else | |
puts "invalid month" | |
end | |
end | |
def options | |
if ARGV[0] == '--list' || ARGV[0] == '-l' | |
puts <<-'EOS' | |
6月, 7月, 8月 1Q | |
9月,10月,11月 2Q | |
12月,1月, 2月 3Q | |
3月, 4月, 5月 4Q | |
EOS | |
elsif ARGV[0] == '--help' || ARGV[0] == '-h' | |
puts <<-'EOS' | |
-h, --help : Show help | |
-l, --list : List all months of quarter | |
EOS | |
else | |
puts <<-'EOS' | |
invalid option | |
-h, --help : Show help | |
-l, --list : List all months of quarter | |
EOS | |
end | |
end | |
ARGV[0].nil? ? what_quarter_now : options |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage