Sha256: 4a48ca9b34476a9e597ee32ac9764e1b007e7b15f69e813d537a48610dad740e
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
#!/usr/bin/env ruby require 'utils/markdown' include Utils::Markdown require 'utils/pager' require 'shellwords' 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"} core_pager = `git config get core.pager`.chomp.full? git_pager = ENV['GIT_PAGER'].full? default_pager = ENV['PAGER'].full? if fallback_pager = `which less`.chomp.full? || `which more`.chomp.full? fallback_pager << ' -r' end my_pager = git_pager || core_pager || default_pager || fallback_pager Utils::Pager.pager(command: my_pager) do |output| IO.popen("#{cmd} #{Shellwords.join(ARGV)}") do |log| until log.eof? message = nil log.each do |line| case line when /^MARKUP$/ message = '' when /^MARKDOWN$/ output.puts markdown(message + "\n---\n") message = nil else if message message << line else output.puts line end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
utils-0.57.1 | bin/git-md |
utils-0.57.0 | bin/git-md |