Handle CLI failure exit status at the top-level script (#28322)
This commit is contained in:
parent
881e8c113c
commit
0e0a94f483
27 changed files with 150 additions and 320 deletions
|
@ -86,14 +86,8 @@ module Mastodon::CLI
|
|||
category = CustomEmojiCategory.find_by(name: options[:category])
|
||||
export_file_name = File.join(path, 'export.tar.gz')
|
||||
|
||||
if File.file?(export_file_name) && !options[:overwrite]
|
||||
say("Archive already exists! Use '--overwrite' to overwrite it!")
|
||||
exit 1
|
||||
end
|
||||
if category.nil? && options[:category]
|
||||
say("Unable to find category '#{options[:category]}'!")
|
||||
exit 1
|
||||
end
|
||||
fail_with_message "Archive already exists! Use '--overwrite' to overwrite it!" if File.file?(export_file_name) && !options[:overwrite]
|
||||
fail_with_message "Unable to find category '#{options[:category]}'!" if category.nil? && options[:category]
|
||||
|
||||
File.open(export_file_name, 'wb') do |file|
|
||||
Zlib::GzipWriter.wrap(file) do |gzip|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue