Class: BeginningOpenSource::CLI
- Inherits:
-
Object
- Object
- BeginningOpenSource::CLI
- Defined in:
- lib/cli.rb
Instance Method Summary collapse
- #call ⇒ Object
- #get_and_print(input_string) ⇒ Object
- #goodbye ⇒ Object
-
#list_beginner_issues ⇒ Object
by default, it will return issues in github repos with 1 star or more.
- #search_issues ⇒ Object
- #welcome ⇒ Object
Instance Method Details
#call ⇒ Object
3 4 5 6 7 8 |
# File 'lib/cli.rb', line 3 def call welcome list_beginner_issues search_issues goodbye end |
#get_and_print(input_string) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/cli.rb', line 38 def get_and_print(input_string) issues_array = BeginningOpenSource::GithubApi.get_issues(input_string) BeginningOpenSource::Issues.create_from_collection(issues_array) if BeginningOpenSource::Issues.starred.empty? BeginningOpenSource::Issues.all.each do |issue| length = "Repository Url: #{issue.repo_url}".length puts " " puts "Issue Title: #{issue.title}".blue puts "Repository Name: #{issue.repo_name}" puts "Repository Description: #{issue.repo_description}" puts "Stars: #{issue.stars}" puts "Labels: #{issue.labels}" puts "Issue Url: #{issue.html_url}" puts "Repository Url: #{issue.repo_url}" length.times {print "*"} end else BeginningOpenSource::Issues.starred.each do |issue| length = "Repository Url: #{issue.repo_url}".length puts " " puts "Issue Title: #{issue.title}".blue puts "Repository Name: #{issue.repo_name}" puts "Repository Description: #{issue.repo_description}" puts "Stars: #{issue.stars}" puts "Labels: #{issue.labels}" puts "Issue Url: #{issue.html_url}" puts "Repository Url: #{issue.repo_url}" length.times {print "*"} end end end |
#goodbye ⇒ Object
34 35 36 |
# File 'lib/cli.rb', line 34 def goodbye puts "Happy learning!" end |
#list_beginner_issues ⇒ Object
by default, it will return issues in github repos with 1 star or more
17 18 19 |
# File 'lib/cli.rb', line 17 def list_beginner_issues #by default, it will return issues in github repos with 1 star or more get_and_print('beginner') end |
#search_issues ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cli.rb', line 21 def search_issues input = nil while input != "exit" puts "\n" + "Enter the issue label you would like to search for or type 'exit'".green input = gets.chomp.scan(/[a-z\s]/).join unless input == 'exit' get_and_print(input) end # list_issues #do i want to return all issues or just the last searched ones. i'm thinking last searched #possibly could store the other in memory to retrieve again if i want end end |
#welcome ⇒ Object
10 11 12 13 14 15 |
# File 'lib/cli.rb', line 10 def welcome puts "Welcome to beginning open source!".blue puts "Viewing open github issues labeled 'beginner' within the ruby language".blue puts " " puts "With this tool, you can find issues on github by label".blue end |