lib/yac.rb in yac-1.4.3 vs lib/yac.rb in yac-1.4.4

- old
+ new

@@ -3,11 +3,11 @@ module Yac include Format extend self - VERSION = '1.4.3' + VERSION = '1.4.4' @color = { 'head1' => "1;31", 'head2' => "1;36", 'head3' => "1;33", @@ -131,14 +131,14 @@ def mv(args) (colorful("Usage:\nyac mv [orign_name] [new_name]","warn");exit) unless args.size == 2 file = search_name(args[0],"Rename") - # You can use $ yac mv linux linux/ to rename linux to linux/linux - new_filename = args[1] =~ /\/$/ ? args[1] : args[1] + file.match(/[^\/]$/).to_s + # You can use $ yac -m linux linux/ to rename linux to linux/linux + new_filename = (args[1] !~ /\/$/) ? args[1] : args[1] + file.match(/[^\/]*$/).to_s.sub(/\.\w*$/,'') new_filename = '@' + new_filename if file =~ /^#{@main_path}/ - new_name = add_file(new_filename) + new_name = add_file(new_filename,'.yac') if new_name && confirm("You Are Renaming #{file} To #{new_name}") Git.mv(file,new_name) end end @@ -263,10 +263,10 @@ return num ? args[num-1].to_s.strip : false #return the filename end def trancate_filename(name) name = name.sub(/\..*$/,'').sub(/^@/,'') - content = name.size > 22 ? '..' + name.reverse[0,20].reverse : name + content = name.size > 22 ? name + "\n" : name end def choose_range(size) colorful("Please Input A Valid Number (1..#{size}) (q:quit): ","notice",false) num = STDIN.gets || exit