Class: Memo::Cli::Command::List

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

Instance Method Summary collapse

Constructor Details

#initialize(options, os: Memo::OS.new) ⇒ List

Returns a new instance of List.



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

def initialize(
  options,
  os: Memo::OS.new
)
  @options = options
  @os = os
  @config = Memo::Config.new
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/memo/cli/command/list.rb', line 14

def call
  namespace = @options.namespace
  is_all = @options.all?
  type = @options.dir? ? "d" : "f"

  dir = if is_all
          ""
        else
          Memo::File.new(
            "",
            @options.namespace,
          ).dir
        end

  @os.exec "find #{@config.root}/#{dir} -type #{type}"
end