| 12345678910111213141516171819202122232425262728293031 |
- #!/usr/bin/env ruby
- require 'fotos'
- require 'optparse'
- COMMANDS = %w(extract organize build)
- parser = OptionParser.new
- case ARGV[0]
- when 'extract'
- parser.on('-z PATH', '--zip', 'Extract a zip file with images from PATH')
- parser.on('-d [PATH]', '--dest', 'Copy to a destinatio dir')
- options = {dest: '.'}
- parser.parse!(into: options)
- Fotos::ZipExtractor.new(options).call
- when 'organize'
- options = {}
- parser.on('-s [PATH]', '--source', 'Input directory with image directories')
- parser.on('-d [PATH]', '--destination', 'Copy to a destinatio dir')
- parser.parse!(into: options)
- Fotos::Organizer.new(options).call
- when 'build'
- parser.on('-s [PATH]', '--source', 'Input directory with image directories')
- parser.on('-d [PATH]', '--dest', 'Output directory for html and images')
- parser.on('-t', '--thumbnails', 'Automatically generate missing thumbnails')
- options = {dest: '.'}
- parser.parse!(into: options)
- Fotos::HtmlGenerator.new(options).call
- else
- puts "Unknown command! Available commands: #{COMMANDS.join(',')}."
- exit(-1)
- end
|