Sha256: f0be3dd5c427da83e550a45f553e96480d99472383edcfe21be25a0ba21206e9

Contents?: true

Size: 843 Bytes

Versions: 5

Compression:

Stored size: 843 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 "list", "l"
              Command::List
            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

5 entries across 5 versions & 1 rubygems

Version Path
ememo-0.2.1 lib/memo/cli/cli.rb
ememo-0.1.8 lib/memo/cli/cli.rb
ememo-0.1.7 lib/memo/cli/cli.rb
ememo-0.1.6 lib/memo/cli/cli.rb
ememo-0.1.5 lib/memo/cli/cli.rb