Sha256: c7cc46f847c783fc27f44dc5b15f16f2fecb13fd1712beea5c06a7fb13f5a23a
Contents?: true
Size: 694 Bytes
Versions: 3
Compression:
Stored size: 694 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 require "pp" gem "builtinextension" require "string/escapezsh.rb" require "filerenamer.rb" #require "filerenamer/commander.rb" require "filerenamer/optionparser.rb" OPTIONS = {} op = FileRenamer::OptionParser.new op.on("-C str" , "--command=str" , "Indicate command to hash."){|val| OPTIONS[:command] = val} op.parse!(ARGV) hash_command = OPTIONS[:command] hash_command ||= "sha256sum" fr = FileRenamer::Commander.new(op.options, ARGV) fr.execute do |filename| extname = File.extname filename oldname = filename.escape_zsh basename = `#{hash_command} #{oldname}`.sub(/ *#{oldname}$/, '').chomp newname = basename + extname newname end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
filerenamer-0.0.9 | bin/renhash |
filerenamer-0.0.8 | bin/renhash |
filerenamer-0.0.7 | bin/renhash |