Sha256: b78a8e98744d28dc57e18952e84ad782b88ea1eafb5205751f0c5d27cd24220f
Contents?: true
Size: 866 Bytes
Versions: 83
Compression:
Stored size: 866 Bytes
Contents
#!/usr/bin/env ruby require 'tempfile' require 'utils' include Utils $config = Utils::Config::ConfigFile.new $utilsrc = File.expand_path('~/.utilsrc') def create_default_utilsrc if File.exist?($utilsrc) Tempfile.open('utilsrc') do |tmp| tmp.puts $config.to_ruby tmp.flush yield tmp.path, $utilsrc end end end case cmd = ARGV.shift when 'show' if File.exist?($utilsrc) puts File.read($utilsrc) else puts $config.to_ruby end when 'default' puts $config.to_ruby when 'diff' create_default_utilsrc do |default_utilsrc, utilsrc| system "diff -u #{default_utilsrc.inspect} #{utilsrc.inspect} | cdiff" end when 'edit' create_default_utilsrc do |default_utilsrc, utilsrc| system "vimdiff #{default_utilsrc.inspect} #{utilsrc.inspect}" end else puts <<EOT Usage: #{File.basename($0)} show|diff|edit EOT end
Version data entries
83 entries across 83 versions & 1 rubygems