Module: Packs::Private::InteractiveCli

Extended by:
T::Sig
Defined in:
lib/packs/private/interactive_cli.rb,
lib/packs/private/interactive_cli/file_selector.rb,
lib/packs/private/interactive_cli/pack_selector.rb,
lib/packs/private/interactive_cli/team_selector.rb,
lib/packs/private/interactive_cli/use_cases/move.rb,
lib/packs/private/interactive_cli/use_cases/check.rb,
lib/packs/private/interactive_cli/use_cases/query.rb,
lib/packs/private/interactive_cli/use_cases/create.rb,
lib/packs/private/interactive_cli/use_cases/rename.rb,
lib/packs/private/interactive_cli/use_cases/update.rb,
lib/packs/private/interactive_cli/use_cases/get_info.rb,
lib/packs/private/interactive_cli/use_cases/validate.rb,
lib/packs/private/interactive_cli/use_cases/interface.rb,
lib/packs/private/interactive_cli/use_cases/move_pack.rb,
lib/packs/private/interactive_cli/use_cases/make_public.rb,
lib/packs/private/interactive_cli/pack_directory_selector.rb,
lib/packs/private/interactive_cli/use_cases/add_dependency.rb,
lib/packs/private/interactive_cli/use_cases/lint_package_yml_files.rb,
lib/packs/private/interactive_cli/use_cases/lint_package_todo_yml_files.rb

Defined Under Namespace

Modules: UseCases Classes: FileSelector, PackDirectorySelector, PackSelector, TeamSelector

Class Method Summary collapse

Class Method Details

.start!(prompt: nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/packs/private/interactive_cli.rb', line 30

def self.start!(prompt: nil)
  prompt ||= TTY::Prompt.new(interrupt: lambda {
                                        puts "\n\nGoodbye! I hope you have a good day."
                                        exit 1 })
  help_text = '(Press ↑/↓ arrow to move, Enter to select and letters to filter)'
  choice = prompt.select('Hello! What would you like to do?',
    cycle: true,
    filter: true,
    help: help_text,
    show_help: :always,
    per_page: 15) do |menu|
    menu.enum '.'

    UseCases::Interface.all.each do |use_case|
      menu.choice use_case.user_facing_name, use_case
    end
  end

  choice.perform!(prompt)
end