From 204f091c15da63964a77d59ac24f89d50fa9facd Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Mon, 18 Sep 2023 16:33:32 +0300 Subject: [PATCH] #64 show query string --- discover-repos.rb | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/discover-repos.rb b/discover-repos.rb index 1cb41a24..6ba9466e 100755 --- a/discover-repos.rb +++ b/discover-repos.rb @@ -50,18 +50,19 @@ end names = [] page = 0 +query = [ + "stars:#{opts['min-stars']}..#{opts['max-stars']}", + "size:>=#{opts['min-size']}", + 'language:java', + 'is:public', + 'mirror:false', + 'archived:false', + 'NOT', + 'android' +].join(' ') loop do json = github.search_repositories( - [ - "stars:#{opts['min-stars']}..#{opts['max-stars']}", - "size:>=#{opts['min-size']}", - 'language:java', - 'is:public', - 'mirror:false', - 'archived:false', - 'NOT', - 'android' - ].join(' '), + query, per_page: size, page: page ) @@ -85,10 +86,12 @@ File.write( opts[:tex], - 'The following search criteria have been used: ' + [ + [ + ' The following search criteria have been used:', "at least #{opts['min-stars']} and at most #{opts['max-stars']} stars", - "at least #{opts['min-size']}Kb size of Git repo" - ].join(', ') + ".\n" + "at least #{opts['min-size']}Kb size of Git repo.", + "The exact query string for GitHub API was the following: ``\\texttt{#{query}}''.\n" + ].join ) path = File.expand_path(opts[:path])