Sha256: 0c009b175cd41c1a53269b5b2707b2b1bf734cbec2487a33c8fdee83a054c140

Contents?: true

Size: 752 Bytes

Versions: 3

Compression:

Stored size: 752 Bytes

Contents

module Memo
  class Cli
    module Command
      class Preview
        def initialize(
          options,
          os: Memo::OS.new
        )
          @options = options
          @os = os
          @config = Memo::Config.new
          @today = Memo::Today.new
          @defaultfile = Memo::File.new
        end

        def call
          filename = @options[0]
          path = case filename
                 when "today", "t"
                   @today.fullpath
                 else
                   Memo::File.new(
                     filename,
                     @options.namespace,
                   ).fullpath
                 end

          @os.exec "#{@config.preview} #{@config.root}/#{path}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ememo-0.1.4 lib/memo/cli/command/preview.rb
ememo-0.1.3 lib/memo/cli/command/preview.rb
ememo-0.1.2 lib/memo/cli/command/preview.rb