Sha256: 7466f890ded8a75e1c0a2ad691e7c804bc88f409f739bccf98839f969d749eda
Contents?: true
Size: 1.24 KB
Versions: 10
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true module Buildkite module Builder module Commands using Rainbow COMMANDS = { 'files' => :Files, 'preview' => :Preview, 'run' => :Run }.freeze autoload :Abstract, File.expand_path('commands/abstract', __dir__) COMMANDS.each do |command, klass| autoload klass, File.expand_path("commands/#{command}", __dir__) end def self.run if ARGV.empty? || ARGV.first == '--help' return print_help end command = ARGV.shift unless (command_class = COMMANDS[command]) raise "Invalid command: #{command}" end const_get(command_class).execute end def self.print_help puts <<~HELP #{'SYNOPSIS'.bright} \t#{'buildkite-builder'.bright} COMMAND [OPTIONS] [PIPELINE] \t#{'To see available options for specific commands:'.color(:dimgray)} \t#{'buildkite-builder'.bright} COMMAND --help #{'COMMANDS'.bright} HELP COMMANDS.each do |command, klass| puts <<~HELP \t#{command.bright} \t#{const_get(klass).description.color(:dimgray)}\n HELP end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems