Skip to content

Commit 0e19e0d

Browse files
committed
Add exit key for options hash
1 parent e531293 commit 0e19e0d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/parser.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def parser(options) # rubocop:disable Metrics/MethodLength
106106

107107
opts.on('-v', '--version', 'Show the current version of this gem') do
108108
puts "annotate v#{Annotate.version}"
109+
options[:exit] = true
109110
end
110111

111112
opts.on('-m', '--show-migration', 'Include the migration version number in the annotation') do
@@ -220,7 +221,8 @@ def parser(options) # rubocop:disable Metrics/MethodLength
220221

221222
def default_options
222223
{
223-
target_action: :do_annotations
224+
target_action: :do_annotations,
225+
exit: false
224226
}
225227
end
226228
end

spec/parser_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@
208208
describe option do
209209
it 'sets the ENV variable' do
210210
expect { Parser.parse([option]) }.to output("annotate v#{Annotate.version}\n").to_stdout
211+
expect(Parser.parse([option])).to include(exit: true)
211212
end
212213
end
213214
end

0 commit comments

Comments
 (0)