You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
muse-dl/src/parser.cr

26 lines
617 B

module Muse::Dl
class Parser
@bookmarks : Bool
@tmp : String
@cleanup : Bool
@output : String
getter :bookmarks, :tmp, :cleanup, :output
def find_next(arg : Array(String), flag : String, default)
search = arg.index flag
if search
return arg[search + 1]
end
return default
end
def initialize(arg : Array(String) = [] of String)
@bookmarks = !arg.index "--no-bookmarks"
@cleanup = !arg.index "--no-cleanup"
@tmp = find_next(arg, "--tmp-dir", "/tmp")
@output = find_next(arg, "--output", "tempfilename.pdf")
end
end
end