Sha256: 71eade00d9616f6b80c54baebb3f6a83bfc3c85f38367d42d5d80aa40754b093

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

#!/usr/bin/env ruby

require 'tempfile'
require 'base64'

def say_it(audio)
  tempfile = Tempfile.new("git-say-log")
  tempfile.write Base64.decode64(audio)
  tempfile.close
  system("afplay #{tempfile.path}")
  sleep(0.5)
ensure
  tempfile.unlink
end

IO.popen("git log --color #{ARGV.join('')}") do |log|
  in_audio = false
  audio = nil

  log.each do |line|
    case
    when line =~ /--BEGIN-AUDIO--$/
      in_audio = true
      audio = ""
    when line =~ /--END-AUDIO--$/
      in_audio = false
      audio << line
      audio << "\n"
      say_it(audio)
    when in_audio
      audio << line
    else
      puts line
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git-audio-commit-1.0.0 bin/git-say-log