Sha256: eb7face49ed77e5847c7dfba8be399c9f61fb610b42758cad9d0d846cf9ed29a

Contents?: true

Size: 1.54 KB

Versions: 21

Compression:

Stored size: 1.54 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/console/docopt_runner'
require 'eac_ruby_utils/console/speaker'
require 'avm/git/issue/complete'

module Avm
  module Tools
    class Runner < ::EacRubyUtils::Console::DocoptRunner
      class Git < ::EacRubyUtils::Console::DocoptRunner
        class Issue < ::EacRubyUtils::Console::DocoptRunner
          class Complete < ::EacRubyUtils::Console::DocoptRunner
            include ::EacRubyUtils::Console::Speaker

            DOC = <<~DOCOPT
              Closes a issue in a Git repository.

              Usage:
                __PROGRAM__ [options]
                __PROGRAM__ -h | --help

              Options:
                -h --help                 Show this screen.
                -B --no-validate-branch   Does not validate branch/tag name.
                -y --yes                  Does not ask for user confirmation.
            DOCOPT

            def run
              complete = ::Avm::Git::Issue::Complete.new(git_complete_issue_options)
              complete.start_banner
              fatal_error('Some validation did not pass') unless complete.valid?
              complete.run if confirm?
            end

            private

            def confirm?
              options.fetch('--yes') || request_input('Confirm issue completion?', bool: true)
            end

            def git_complete_issue_options
              { dir: context(:repository_path),
                no_validate_branch: options.fetch('--no-validate-branch') }
            end
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
avm-tools-0.33.1 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.33.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.32.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.31.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.30.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.28.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.27.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.26.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.25.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.24.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.23.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.22.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.21.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.20.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.19.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.18.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.17.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.16.0 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.15.1 lib/avm/tools/runner/git/issue/complete.rb
avm-tools-0.15.0 lib/avm/tools/runner/git/issue/complete.rb