Sha256: 1c2dc2c35964721899209b190f3bbd1422de859c47c0f3e2b65c66bd3219e714

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

# This file is part of Alexandria.
#
# See the file README.md for authorship and licensing information.

require 'gettext'
require 'alexandria'
require 'optparse'
require 'ostruct'

store = Alexandria::LibraryStore.new(Alexandria::Library::DEFAULT_DIR)
Alexandria::LibraryCollection.instance.library_store = store

# options = OpenStruct.new
OptionParser.new do |opts|
  opts.banner = 'Usage: alexandria [options]'
  opts.on('-l', '--list', 'List libraries in numbered format') do
    puts Alexandria.list_books_on_console
    exit
  end
  # opts.on("--output FORMAT",
  #        "Output library as FORMAT: csv|xml|yaml; use with --library or omit for ALL") do |val|
  #        options.format = val
  #        exit
  # end
  # opts.on("--library LIBRARY",
  #        "Used with --output to pick a library to output") do |val|
  #        options.library = val
  #        exit
  # end
  opts.on('-d', '--debug', 'Run in debug mode') do
    $DEBUG = true
  end
  opts.on('-h', '--help', 'Show help options') do
    puts opts
    exit
  end
  opts.on('-v', '--version', 'Get version number') do
    puts Alexandria::VERSION
    exit
  end
end.parse!

begin
  Alexandria.main
rescue StandardError => e
  warn <<~EOS
    -----------------------
    Alexandria just crashed
    -----------------------
    Timestamp: #{Time.now}
    Message: #{e.message}
    Backtrace:
    #{e.backtrace.join("\n")}
    Release: #{Alexandria::VERSION}(#{Alexandria::DISPLAY_VERSION})
    Uname -a: #{`uname -a`.chomp}
    --
    Please report this dump to '#{Alexandria::BUGREPORT_URL}' with some additional
    information, such as the description of the crash and the steps to reproduce it
    (if it's possible).
  EOS
  exit 1
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alexandria-book-collection-manager-0.7.3 bin/alexandria