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
avm-0.94.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.94.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.93.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.92.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.92.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.91.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.90.1 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.87.1 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.90.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.87.0 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.89.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.86.12 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.88.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.86.11 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.87.0 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.86.8 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.86.2 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.86.7 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb
avm-0.86.1 lib/avm/scms/auto_commit/rules/manual.rb
eac_tools-0.86.5 sub/avm/lib/avm/scms/auto_commit/rules/manual.rb