Sha256: ce7239bd2681d585b7c6b386e703389c29be5344e6f0ea21d6e7796942e9e71d
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
#!/usr/bin/env ruby require 'tempfile' require 'base64' options = {} def capture(name) val = nil ARGV.each_with_index do |arg, index| if arg == name val = ARGV[index+1] ARGV.delete_at(index+1) ARGV.delete_at(index) end end val end options[:audio] = capture("--audio") options[:message] = capture("-m") if options[:audio].nil? || options[:message].nil? puts "Usage: git audio-commit --audio <audio-file> -m <message> ..." exit(1) end tempfile = Tempfile.new("git-audio-commit") begin tempfile << options[:message] tempfile << "\n\n--BEGIN-AUDIO--\n" tempfile << Base64.encode64(File.read(options[:audio])) tempfile << "--END-AUDIO--\n" tempfile.close system("git commit -F #{tempfile.path} #{ARGV.join(" ")}") ensure tempfile.unlink end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git-audio-commit-1.0.0 | bin/git-audio-commit |