Sha256: 4e1fb1e0bf0e19722dd5706ee95fb6fc6620f8f6e87adf24bd574b5f14003f3a

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require "thor"

module Codestatus
  class CLI < Thor
    desc "status REGISTRY/PACKAGE", "Show status of the package"
    option :registry, type: :string, aliases: 'r'
    option 'show-package-name', type: :boolean, default: false
    def status(slug)
      if options[:registry]
        package_registry = options[:registry]
        package_name = slug
      else
        package_registry, package_name = slug.split('/', 2)
      end

      status = Codestatus.status(registry: package_registry, package: package_name)
      success = (status.status == BuildStatus::SUCCESS)

      if options['show-package-name']
        puts "#{package_name}: #{status.status}"
      else
        puts status.status
      end
      exit success ? 0 : 1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
codestatus-0.1.3 lib/codestatus/cli.rb
codestatus-0.1.2 lib/codestatus/cli.rb