Sha256: 7cd37480432db732367d0d8d93951b0cff0cd98d7cbd745d247bf65e244ce569

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

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

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

      def configure_command(builder, opts)
        builder = super(builder, opts)
        builder
          .with_subcommand('destroy-pipeline') do |sub|
          sub = with_target(sub, opts[:target])
          sub = with_pipeline(sub, opts[:pipeline])
          sub = with_team(sub, opts[:team])
          sub = with_non_interactive(sub, opts[:non_interactive])
          sub
        end
      end

      private

      def required_params
        %i[target pipeline]
      end

      def with_target(sub, target)
        sub.with_option('-t', target)
      end

      def with_pipeline(sub, pipeline)
        sub.with_option('-p', pipeline)
      end

      def with_team(sub, team)
        return sub unless team

        sub.with_option('--team', team)
      end

      def with_non_interactive(sub, non_interactive)
        return sub unless non_interactive

        sub.with_flag('-n')
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ruby_fly-0.40.0.pre.4 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.40.0.pre.3 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.40.0.pre.2 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.40.0.pre.1 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.39.0 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.38.0.pre.5 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.38.0.pre.4 lib/ruby_fly/commands/destroy_pipeline.rb
ruby_fly-0.38.0.pre.3 lib/ruby_fly/commands/destroy_pipeline.rb