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.69.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.75.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.69.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.74.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.68.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.73.1 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.67.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.73.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.67.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.72.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.66.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.65.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.71.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.65.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.70.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.64.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.69.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.63.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.62.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.68.0 lib/avm/scms/auto_commit/rules/manual.rb