Finished feature

This commit is contained in:
Tristan Ancelet 2024-05-26 12:39:50 -05:00
parent 91d06fa18c
commit c6f238ae01

View File

@ -37,6 +37,7 @@ Restore Flags:
Global Flags: Global Flags:
-d | --debug : Set debug flag -d | --debug : Set debug flag
-h | --help : This help message -h | --help : This help message
-b | --bucket <bucket-dir> : User specified bucket directory
Listing Filter Flags: Listing Filter Flags:
--from-date <DATE> : Filter listings from starting after this point (FORMAT: YYYY-MM-DD HH:MM:SS) --from-date <DATE> : Filter listings from starting after this point (FORMAT: YYYY-MM-DD HH:MM:SS)
@ -284,6 +285,19 @@ while i < ARGV.count
usage usage
exit exit
end end
when '-b', '--bucket'
log "user provided ARGV[i.next] == #{ARGV[i.next]}"
if ARGV[i.next] != "" and not ARGV[i.next] =~ FLAG_REGEX
$CONFIG[:bucketdir]=ARGV[i.next]
log "$CONFIG[:bucketdir] was set to #{ARGV[i.next]}"
i+=2
else
puts "Flag[#{ARGV[i]}] : Argument[#{ARGV[i.next]}] : Either the argument was not provided or it was a flag"
usage
exit
end
when '--to-date', '--from-date' when '--to-date', '--from-date'
if ARGV[i.next] != "" and ARGV[i.next] =~ DATE_REGEX if ARGV[i.next] != "" and ARGV[i.next] =~ DATE_REGEX
date_matches = DATE_REGEX.match(ARGV[i.next]).named_captures.each_value.select{|val| not val.nil?}.map(&:to_i) date_matches = DATE_REGEX.match(ARGV[i.next]).named_captures.each_value.select{|val| not val.nil?}.map(&:to_i)
@ -319,6 +333,11 @@ if $CONFIG[:action] == ""
puts "Action was not provided" puts "Action was not provided"
end end
if not Dir.exist? $CONFIG[:bucketdir]
puts "BucketDir[#{$CONFIG[:bucketdir]}] Does not exist. Please check to make sure configuration is correct"
exit
end
case $CONFIG[:action] case $CONFIG[:action]
when 'search', 'get' when 'search', 'get'
if $CONFIG[:search_term] == "" if $CONFIG[:search_term] == ""