Sha256: 6d8f523eba4564d53fceb290ed5eec9e72225e06f2aa9702038f96ec9ac2bf7b

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

# typed: strict
# frozen_string_literal: true

module Paperback
  module CLI
    extend T::Sig

    # Top level CLI interface for Paperback. This is the one stop shop for
    # calling paperback.
    #
    # @param [String] input The input filename
    # @param [String] output The output PDF filename
    # @param [Boolean] encrypt Whether to encrypt input with GPG.
    # @param [Boolean] qr_base64 Whether to base64 the data before encoding it
    #   as a QR code
    # @param [Symbol] qr_level Which level of QR code encoding, default `:l`
    # @param [String,nil] comment A comment to add to the printout
    # @param [String] passphrase_file A file to write the generated GPG
    #   passphrase to
    # @param [Hash] extra_draw_opts Other options passed to
    #   [Paperback::Preparer#render]
    # @param [Boolean] include_base64 Whether to include a Base64 copy of the
    #   input
    sig do
      params(
        input: String,
        output: String,
        encrypt: T::Boolean,
        qr_base64: T::Boolean,
        qr_level: Symbol,
        comment: T.nilable(String),
        passphrase_file: T.nilable(String),
        extra_draw_opts: T::Hash[T.untyped, T.untyped],
        include_base64: T::Boolean,
      )
        .void
    end
    def self.create_backup(input:, output:, encrypt: true, qr_base64: true,
                           qr_level: :l, comment: nil, passphrase_file: nil,
                           extra_draw_opts: {}, include_base64: true)
      prep = Paperback::Preparer.new(filename: input, encrypt: encrypt,
                                     qr_base64: qr_base64, qr_level: qr_level,
                                     passphrase_file: passphrase_file,
                                     comment: comment,
                                     include_base64: include_base64)
      prep.render(output_filename: output, extra_draw_opts: extra_draw_opts)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paperback-0.0.5 lib/paperback/cli.rb