Created
February 27, 2009 12:20
-
-
Save tomlea/71438 to your computer and use it in GitHub Desktop.
Prevent textmate exploding when you do a "mate /" by accident.
This file contains hidden or 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
| function mateforce(){ | |
| `which mate` $* | |
| } | |
| function mate(){ | |
| if find $* -type f | ~/line_count_less_than 1000 | |
| then | |
| mateforce $* | |
| else | |
| echo "Too many files!" | |
| echo "If you are sure you wish to do this, then please use mateforce" | |
| false | |
| fi | |
| } |
This file contains hidden or 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/env ruby | |
| max_count = ARGV.first.to_i | |
| count = 0 | |
| while STDIN.gets | |
| count += 1 | |
| exit 1 if count > max_count | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment