Sha256: bab8a6a25807045bfca5dcbf8c8edbbe8ab4ac164f271bd9cd9c3b3f38f09dfe

Contents?: true

Size: 1.04 KB

Versions: 118

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'avm/scms/auto_commit/rules/base'

module Avm
  module Scms
    module AutoCommit
      module Rules
        class Manual < ::Avm::Scms::AutoCommit::Rules::Base
          class WithFile < ::Avm::Scms::AutoCommit::Rules::Base::WithFile
            enable_speaker

            SKIP_OPTION = 's'

            def commit_info
              return nil unless file.commits.any?

              commits_banner
              input('Which commit?', list: commits_by_position).if_present do |v|
                new_commit_info.fixup(v)
              end
            end

            def commits_banner
              file.commits.each_with_index do |commit, _index|
                infov "    #{commit.position}", commit
              end
              infov "    #{SKIP_OPTION}", 'skip'
            end

            def commits_by_position
              (file.commits.map { |commit| [commit.position.to_s, commit] } + [[SKIP_OPTION, nil]])
                .to_h
            end
          end
        end
      end
    end
  end
end

Version data entries

118 entries across 118 versions & 2 rubygems

Version Path
eac_tools-0.79.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.80.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.78.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.77.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.77.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.76.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.76.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.75.2 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.75.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.75.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.74.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.74.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.79.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.73.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.72.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.78.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.70.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.77.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.70.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.76.0 lib/avm/scms/auto_commit/rules/manual.rb