Skip to content

Commit

Permalink
#1 clean
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 4, 2022
1 parent 2ae8552 commit 8479b67
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions bin/mergem
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ end
args = config('~/.mergem') + config('.mergem') + ARGV

opts = Slop.parse(args, strict: true, help: true) do |o|
o.banner = "Usage (#{mergem::VERSION}): mergem [options]"
o.banner = "Usage (#{Mergem::VERSION}): mergem [options]"
o.bool '-h', '--help', 'Show these instructions'
o.bool '--version', 'Show current version'
o.bool '--verbose', 'Print as much log messages as possible'
o.bool '--dry', 'Make no real round trips to GitHub'
o.string '--cache', 'Use this file as a cache, to avoid duplicated roudtrips to GitHub', default: '.mergem-cache'
o.integer '--delay', 'Delay between HTTP calls to GitHub API, in milliseconds', default: 1000
o.string '--token', 'GitHub authentication token', required: true
o.array '--repo', 'GitHub repo to check, e.g. yegor256/blog', required: true
o.string '--token', 'GitHub authentication token'
o.array '--repo', 'GitHub repo to check, e.g. yegor256/blog'
end

if opts.help? || opts[:coder].empty?
if opts.help?
puts opts
exit
end
Expand All @@ -62,7 +62,7 @@ if opts.verbose?
end

if opts.version?
loog.info(mergem::VERSION)
loog.info(Mergem::VERSION)
exit
end

Expand All @@ -72,8 +72,11 @@ Encoding.default_internal = Encoding::UTF_8
begin
cache = File.absolute_path(opts[:cache])
loog.debug("Cache file is #{cache}")
opts[:repos].each do |r|
loog.debug("Repo #{r} checked")
repos = 0
pulls = 0
opts[:repo].each do |r|
loog.info("Repo #{r} checked")
repos += 1
end
loog.debug("#{repos} checked, #{pulls} processed")
rescue StandardError => e
Expand Down
2 changes: 1 addition & 1 deletion features/cli.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Feature: Simple Reporting
Then Exit code is zero

Scenario: Simple roundtrip to GitHub
When I run bin/mergem with "--repo yegor256/mergem --dry --token foo"
When I run bin/mergem with "--repo yegor256/mergem --dry"
Then Stdout contains "Repo yegor256/mergem checked"
And Exit code is zero

0 comments on commit 8479b67

Please sign in to comment.