Sha256: 35459eb2203d2375b150c1095cd578e8e5dc7573152369cba0dbb026efd926a9

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 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('/')
      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

1 entries across 1 versions & 1 rubygems

Version Path
codestatus-0.1.1 lib/codestatus/cli.rb