File: cng

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 (35 lines) | stat: -rwxr-xr-x 654 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
#!/usr/bin/env ruby

# frozen_string_literal: true

$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))

require 'gitlab/cng/cli'

Signal.trap('INT') do
  warn("\n#{caller.join("\n")}: interrupted")
  exit(1)
end

module Cng
  class << self
    def run
      Gitlab::Cng::Helpers::Output.force_color! if force_color?

      Gitlab::Cng::CLI.start
    rescue Gitlab::Cng::CLI::Error => e
      puts "ERROR: #{e.message}"
      exit 1
    end

    private

    def force_color?
      ENV["CNG_FORCE_COLOR"]&.match?(/^(true|yes|1)$/i) || %w[--force-color --force-color=true].any? do |arg|
        ARGV.include?(arg)
      end
    end
  end
end

Cng.run