Class: Packs::Private::InteractiveCli::FileSelector

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/packs/private/interactive_cli/file_selector.rb

Class Method Summary collapse

Class Method Details

.select(prompt) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/packs/private/interactive_cli/file_selector.rb', line 10

def self.select(prompt)
  prompt.on(:keytab) do
    raw_paths_relative_to_root = prompt.multiline('Please copy in a space or new line separated list of files or directories')
    paths_relative_to_root = T.let([], T::Array[String])
    raw_paths_relative_to_root.each do |path|
      paths_relative_to_root += path.chomp.split
    end

    return paths_relative_to_root
  end

  [prompt.ask('Please input a file or directory to move (press tab to enter multiline mode)')]
end