lib/spoom/cli/bump.rb in spoom-1.1.12 vs lib/spoom/cli/bump.rb in spoom-1.1.13
- old
+ new
@@ -69,11 +69,11 @@
end
say("\n")
if files_to_bump.empty?
- say("No file to bump from `#{from}` to `#{to}`")
+ say("No files to bump from `#{from}` to `#{to}`")
exit(0)
end
Sorbet::Sigils.change_sigil_in_files(files_to_bump, to)
@@ -86,11 +86,11 @@
error_url_base = Spoom::Sorbet::Errors::DEFAULT_ERROR_URL_BASE
result = Sorbet.srb_tc(
"--error-url-base=#{error_url_base}",
path: exec_path,
capture_err: true,
- sorbet_bin: options[:sorbet]
+ sorbet_bin: options[:sorbet],
)
check_sorbet_segfault(result.exit_code) do
say_error(<<~ERR, status: nil)
It means one of the file bumped to `typed: #{to}` made Sorbet crash.
@@ -130,24 +130,25 @@
exit(files_changed.empty?)
end
no_commands do
def print_changes(files, command:, from: "false", to: "true", dry: false, path: File.expand_path("."))
- if files.empty?
- say("No file to bump from `#{from}` to `#{to}`")
+ files_count = files.size
+ if files_count.zero?
+ say("No files to bump from `#{from}` to `#{to}`")
return
end
message = StringIO.new
message << (dry ? "Can bump" : "Bumped")
- message << " `#{files.size}` file#{"s" if files.size > 1}"
+ message << " `#{files_count}` file#{"s" if files_count > 1}"
message << " from `#{from}` to `#{to}`:"
say(message.string)
files.each do |file|
file_path = Pathname.new(file).relative_path_from(path)
say(" + #{file_path}")
end
if dry && command
- say("\nRun `#{command}` to bump them")
+ say("\nRun `#{command}` to bump #{files_count > 1 ? "them" : "it"}")
elsif dry
say("\nRun `spoom bump --from #{from} --to #{to}` locally then `commit the changes` and `push them`")
end
end