Class: Memo::Cli::Command::Custom

Inherits:
Object
  • Object
show all
Defined in:
lib/memo/cli/command/custom.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, os: Memo::OS.new) ⇒ Custom

Returns a new instance of Custom.



5
6
7
8
9
10
11
# File 'lib/memo/cli/command/custom.rb', line 5

def initialize(
  command,
  os: Memo::OS.new
)
  @command = command
  @os = os
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/memo/cli/command/custom.rb', line 13

def call
  input = Memo::Alias::Command.new(
    @command,
  ).()&.split(" ")

  if input.nil?
    puts Error::Unknown.new.to_s
    puts Memo::Usage.new.to_s
    return
  end

  Memo::Cli.new(input, os: @os).call
end