From a414db8148526361d007525cb4c6002e3ef1e6f4 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Fri, 8 Apr 2016 00:55:18 +0900 Subject: [PATCH 1/3] Add `-d` option --- lib/github/nippou/commands.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/github/nippou/commands.rb b/lib/github/nippou/commands.rb index 5ed0ff4..1f2a7bc 100644 --- a/lib/github/nippou/commands.rb +++ b/lib/github/nippou/commands.rb @@ -14,6 +14,7 @@ class Commands < Thor class_option :until_date, type: :string, default: Time.now.strftime('%Y%m%d'), aliases: :u, desc: 'Retrieves GitHub user_events until the date' + class_option :debug, type: :boolean, default: false, aliases: :d, desc: 'Debug mode' desc 'list', "Displays today's GitHub events formatted for Nippou" def list @@ -42,7 +43,7 @@ def user_events end def format_line(user_event, i) - puts "#{i % thread_num} : #{user_event.html_url}" if ENV['GITHUB_NIPPOU_DEBUG'] + puts "#{i % thread_num} : #{user_event.html_url}" if debug issue = issue(user_event) line = "* [%s - %s](%s) by %s" % [issue.title.markdown_escape, user_event.repo.name, user_event.html_url, issue.user.login] @@ -128,6 +129,10 @@ def thread_num 5 end.to_i end + + def debug + @debug ||= options[:debug] + end end end end From 7f1da85c21677e36f7e41d0acb12809390c11532 Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Fri, 8 Apr 2016 00:58:43 +0900 Subject: [PATCH 2/3] Useful debug mode --- lib/github/nippou/commands.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github/nippou/commands.rb b/lib/github/nippou/commands.rb index 1f2a7bc..5141470 100644 --- a/lib/github/nippou/commands.rb +++ b/lib/github/nippou/commands.rb @@ -43,7 +43,7 @@ def user_events end def format_line(user_event, i) - puts "#{i % thread_num} : #{user_event.html_url}" if debug + STDERR.puts "#{i % thread_num} : #{user_event.html_url}\n" if debug issue = issue(user_event) line = "* [%s - %s](%s) by %s" % [issue.title.markdown_escape, user_event.repo.name, user_event.html_url, issue.user.login] From 51327c2aba7ac524fafef5b9e45a1e18b995ce0a Mon Sep 17 00:00:00 2001 From: Takashi Masuda Date: Fri, 8 Apr 2016 00:59:44 +0900 Subject: [PATCH 3/3] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 47a3ce4..7c50fe9 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Options: # Default: 20160326 u, [--until-date=UNTIL_DATE] # Retrieves GitHub user_events until the date # Default: 20160326 + d, [--debug], [--no-debug] # Debug mode ``` You can get your GitHub Nippou on today.