Sha256: 0a8c78326168e07c9208ecac93209e0bfb1dafa63d82e77463212c1cd14f5acd

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

require 'lino'
require_relative 'base'
require_relative 'mixins/environment'

module RubyFly
  module Commands
    class DestroyPipeline < Base
      include Mixins::Environment

      def configure_command(builder, opts)
        builder = super(builder, opts)

        missing_params = [
            :target,
            :pipeline
        ].select { |param| opts[param].nil? }

        unless missing_params.empty?
          description = missing_params.map { |p| "'#{p}'" }.join(', ')
          raise(
              ArgumentError,
              "Error: #{description} required but not provided.")
        end

        target = opts[:target]
        pipeline = opts[:pipeline]
        non_interactive = opts[:non_interactive]
        team = opts[:team]

        builder
            .with_subcommand('destroy-pipeline') do |sub|
              sub = sub.with_option('-t', target)
              sub = sub.with_option('-p', pipeline)
              sub = sub.with_option('--team', team) if team
              sub = sub.with_flag('-n') if non_interactive
              sub
            end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby_fly-0.38.0.pre.2 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.38.0.pre.1 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.37.0 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.36.0.pre.5 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.36.0.pre.4 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.36.0.pre.3 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.36.0.pre.2 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.36.0.pre.1 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.35.0 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.34.0.pre.1 lib/ruby_fly/commands/destroy_pipeline.rb