Created
August 2, 2012 06:09
-
-
Save du-song/3234301 to your computer and use it in GitHub Desktop.
fack - free from arguable code style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, re, subprocess | |
a = sys.argv[1].split("_") | |
subprocess.call("ack -i " + sys.argv[1] + "\\|" + (''.join(a) if (len(a)>1) else re.sub(r'([a-z]*)([A-Z])', r'\1_\2', a[0])), shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WEI-WEIs-MacBook-Pro-2:testfack weiwei$ cat ~/Dropbox/bin/fack.rb
!/usr/bin/ruby
require 'rubygems'
require 'active_support/all'
exec"ack '#{ARGV[0]}|#{ARGV[0].camelize}|#{ARGV[0].underscore}'"