Sha256: bd80ea1315cb5231323c37dac7d90a2fdc5fb8006441d8f1b4bc0ca13d0cf3d1

Contents?: true

Size: 689 Bytes

Versions: 6

Compression:

Stored size: 689 Bytes

Contents

#!/usr/bin/env ruby

require 'ollama'
require 'shellwords'

def markdown(message)
  Ollama::Utils::ANSIMarkdown.parse(message)
end

cmd = %{git log --color=always --pretty=format:"commit %C(auto)%H%d%nDate:   %Cgreen%cD (%cr)%Creset%nAuthor: %Cblue%an <%ae>%Creset%n%nMARKUP%n%s%n%n%b%nMARKDOWN%n"}

IO.popen("#{cmd} #{Shellwords.join(ARGV)}") do |log|
  until log.eof?
    message = nil
    log.each do |line|
      case line
      when /^MARKUP$/
        message =  ''
      when /^MARKDOWN$/
        puts markdown(message + "\n---\n")
        message = nil
      else
        if message
          message << line
        else
          puts line
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
utils-0.56.1 bin/git-md
utils-0.56.0 bin/git-md
utils-0.55.0 bin/git-md
utils-0.54.1 bin/git-md
utils-0.54.0 bin/git-md
utils-0.53.1 bin/git-md