Fix output-file flag when INPUT FILE is given

This commit is contained in:
Nemo 2020-03-30 01:17:44 +05:30
parent 5ea33ef7b2
commit 923e589413
2 changed files with 9 additions and 2 deletions

View File

@ -20,8 +20,8 @@ module Muse::Dl
# If file exists and we can't clobber
if File.exists?(parser.output) && parser.clobber == false
STDERR.puts "File already exists, not doing anything"
Process.exit(1)
STDERR.puts "File already exists: #{parser.output}"
return
end
temp_stitched_file = nil
pdf_builder = Pdftk.new(parser.tmp)
@ -52,7 +52,10 @@ module Muse::Dl
input_list = parser.input_list
if input_list
File.each_line input_list do |url|
# TODO: Change this to nil
parser.reset_output_file
parser.url = url.strip
# Ask the download process to not quit the process, and return instead
Main.dl parser
end
elsif parser.url

View File

@ -22,6 +22,10 @@ module Muse::Dl
@output = output_file unless @output != DEFAULT_FILE_NAME
end
def reset_output_file
@output = DEFAULT_FILE_NAME
end
def find_next(arg : Array(String), flag : String, default)
search = arg.index flag
if search