Sha256: b56016fc3432515d6ad13b7889bd4b005cae6cf854ad6de0df65bf53434953cb

Contents?: true

Size: 786 Bytes

Versions: 3

Compression:

Stored size: 786 Bytes

Contents

module Memo
  class Cli
    def initialize(
      input,
      os: Memo::OS.new
    )
      @command = input[0]
      @options = Option.new input[1..]
      @os = os
    end

    def call
      cmd = case @command
            when "edit", "e", nil
              Command::Edit
            when "preview", "p"
              Command::Preview
            when "today", "t"
              Command::Today
            when "config", "c"
              Command::Config
            when "help", "h"
              Command::Help
            when "setup", "s"
              Command::Setup
            when "fuzzy", "f"
              Command::Fuzzy
            else
              @options = @command
              Command::Custom
            end

      cmd.new(@options, os: @os).()
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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