Class: Packs::Private::InteractiveCli::PackDirectorySelector

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

Class Method Summary collapse

Class Method Details

.select(prompt, question_text: 'Select a directory') ⇒ Object



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

def self.select(prompt, question_text: 'Select a directory')
  directories = T.let([], T::Array[String])

  Packs::Specification.config.pack_paths.each do |path|
    directories += Dir.glob(path).select { |f| File.directory? f }
  end

  prompt.select(
    question_text,
    directories,
    filter: true,
    per_page: 10,
    show_help: :always
  )
end