Class: Strata::CLI::SubCommands::Table
- Inherits:
-
Thor
- Object
- Thor
- Strata::CLI::SubCommands::Table
- Extended by:
- Helpers::DescriptionHelper
- Includes:
- Guard, Helpers::CommandContext, Output, Prompts, Terminal, Thor::Actions
- Defined in:
- lib/strata/cli/sub_commands/table.rb
Constant Summary
Constants included from DatasourceHelper
DatasourceHelper::ADAPTER_DRIVER_GEMS
Constants included from Output
Constants included from Prompts
Prompts::MIGRATION_HOOK_OPTIONS, Prompts::MSG_CONTINUE_NO_FIELDS, Prompts::MSG_CREATED_MODEL, Prompts::MSG_EDIT_MODEL_HINT, Prompts::MSG_FIELDS_CONFIRMED, Prompts::MSG_JOIN_CONDITION, Prompts::MSG_MODELS_COUNT, Prompts::MSG_MODELS_LIST_HEADER, Prompts::MSG_MODEL_DESCRIPTION, Prompts::MSG_MODEL_DISPLAY_NAME, Prompts::MSG_NO_FIELDS_CONFIRMED, Prompts::MSG_NO_MODELS_DIR, Prompts::MSG_NO_MODELS_FOUND, Prompts::MSG_NO_TABLES_FOUND, Prompts::MSG_RELATION_PATH, Prompts::MSG_SEARCH_TABLE, Prompts::MSG_SELECT_FROM_LIST, Prompts::MSG_SELECT_LEFT_TABLE, Prompts::MSG_SELECT_RIGHT_TABLE_ALL, Prompts::MSG_SELECT_RIGHT_TABLE_SUGGESTED, Prompts::MSG_SHOW_OTHER_TABLES
Constants included from Guard
Instance Method Summary collapse
Methods included from Helpers::DescriptionHelper
Methods included from Helpers::CommandContext
#adapter, #all_tables, #datasource_key, #prompt, #table_fetch_result
Methods included from DatasourceHelper
#apply_readonly_mode, #create_adapter, #ds_config, #ensure_adapter_driver_gems!, #load_adapter_driver_gems!, #resolve_datasource, #resolve_datasource_value
Methods included from Output
format, pastel, print_error, #print_error, print_hint, #print_hint, print_info, #print_info, print_status, #print_status, print_success, #print_success, print_warning, #print_warning, shell_for, thor_color
Methods included from Prompts
Methods included from Terminal
#create_spinner, #print_table, #with_spinner
Methods included from Guard
Instance Method Details
#list ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/strata/cli/sub_commands/table.rb', line 20 def list unless Dir.exist?("models") print_warning(MSG_NO_MODELS_DIR) return end model_files = Dir.glob("models/**/tbl[._]*.yml").sort if model_files.empty? print_warning(MSG_NO_MODELS_FOUND) return end print_info(MSG_MODELS_LIST_HEADER) model_files.each do |file| display_model_item(file) end print_info(MSG_MODELS_COUNT % model_files.length) end |