File: helpers.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (43 lines) | stat: -rwxr-xr-x 1,420 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
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
42
43
# frozen_string_literal: true

require_relative './helpers/cli_inputs'
require_relative './helpers/files'
require_relative './helpers/formatting'
require_relative './helpers/group_ownership'
require_relative './helpers/event_options'
require_relative './helpers/metric_options'
require_relative './helpers/service_ping_dashboards'

module InternalEventsCli
  module Helpers
    include CliInputs
    include Files
    include Formatting
    include GroupOwnership
    include EventOptions
    include MetricOptions
    include ServicePingDashboards

    MILESTONE = File.read('VERSION').strip.match(/(\d+\.\d+)/).captures.first
    NAME_REGEX = /\A[a-z0-9_]+\z/

    def new_page!(page = nil, total = nil, steps = [])
      cli.say TTY::Cursor.clear_screen
      cli.say TTY::Cursor.move_to(0, 0)
      cli.say "#{progress_bar(page, total, steps)}\n" if page && total
    end

    def feedback_notice
      format_heading <<~TEXT.chomp
        Thanks for using the Internal Events CLI!

        Please reach out with any feedback!
          About Internal Events: https://gitlab.com/gitlab-org/analytics-section/analytics-instrumentation/internal/-/issues/687
          About CLI: https://gitlab.com/gitlab-org/gitlab/-/issues/434038
          In Slack: #g_analyze_analytics_instrumentation

        Let us know that you used the CLI! React with 👍 on the feedback issue or post in Slack!
      TEXT
    end
  end
end