Class: GitlabInternalEventsCli::Cli
- Inherits:
-
Object
- Object
- GitlabInternalEventsCli::Cli
- Includes:
- Helpers
- Defined in:
- lib/gitlab_internal_events_cli/cli.rb
Constant Summary
Constants included from Helpers
Constants included from Helpers::Formatting
Helpers::Formatting::DEFAULT_WINDOW_HEIGHT, Helpers::Formatting::DEFAULT_WINDOW_WIDTH
Constants included from Helpers::Files
Helpers::Files::MAX_FILENAME_LENGTH
Instance Attribute Summary collapse
-
#cli ⇒ Object
readonly
Returns the value of attribute cli.
Instance Method Summary collapse
-
#initialize(cli) ⇒ Cli
constructor
A new instance of Cli.
- #run ⇒ Object
Methods included from Helpers
#feedback_notice, #milestone, #new_page!
Methods included from Helpers::ServicePingDashboards
#metric_exploration_group_path, #metric_trend_path
Methods included from Helpers::MetricOptions
Methods included from Helpers::EventOptions
#events_by_filepath, #generate_ai_event_suggestion, #generate_python_advice, #get_event_options
Methods included from Helpers::GroupOwnership
#find_categories, #find_section, #find_stage, #known_categories, #prompt_for_feature_categories, #prompt_for_group_ownership
Methods included from Helpers::Formatting
#clear_format, #counter, #divider, #format_error, #format_heading, #format_help, #format_info, #format_prefix, #format_prompt, #format_selection, #format_subheader, #format_warning, #progress_bar
Methods included from Helpers::Files
#absolute_path, #file_saved_message, #prompt_to_save_file, #write_to_file
Methods included from Helpers::CliInputs
#disableable_option, #disabled_format_callback, #filter_opts, #format_disabled_options_as_dividers, #input_optional_text, #input_opts, #input_required_text, #multiselect_opts, #prompt_for_array_selection, #prompt_for_text, #select_option_divider, #select_opts, #yes_no_opts
Constructor Details
#initialize(cli) ⇒ Cli
Returns a new instance of Cli.
9 10 11 |
# File 'lib/gitlab_internal_events_cli/cli.rb', line 9 def initialize(cli) @cli = cli end |
Instance Attribute Details
#cli ⇒ Object (readonly)
Returns the value of attribute cli.
7 8 9 |
# File 'lib/gitlab_internal_events_cli/cli.rb', line 7 def cli @cli end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gitlab_internal_events_cli/cli.rb', line 13 def run HttpCache.preload! cli.say feedback_notice check_for_updates cli.say instructions task = cli.select('What would you like to do?', **select_opts) do || .enum '.' .choice "New Event -- track when a specific scenario occurs on gitlab instances\n " \ 'ex) a user applies a label to an issue', :new_event .choice "New Metric -- track the count of existing events over time\n " \ 'ex) count unique users who assign labels to issues per month', :new_metric .choice 'View Usage -- look at code and testing examples for existing events & metrics', :view_usage .choice '...am I in the right place?', :help_decide end case task when :new_event Flows::EventDefiner.new(cli).run when :new_metric Flows::MetricDefiner.new(cli).run when :view_usage Flows::UsageViewer.new(cli).run when :help_decide Flows::FlowAdvisor.new(cli).run end end |