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.62.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.61.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.61.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.67.1 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.60.3 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.60.2 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.67.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.60.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.60.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.59.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.66.1 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.58.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.57.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.56.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.66.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.56.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.65.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.55.7 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.64.2 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.55.6 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb