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
|