Last active
August 29, 2015 13:57
-
-
Save jbradforddillon/9883753 to your computer and use it in GitHub Desktop.
Super simple implementation stubber. Point it at a .h file.
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/env python | |
import sys | |
f = open(sys.argv[1]) | |
output = "" | |
for line in f: | |
if line[0:10] == "@interface": | |
colonIndex = line.find(":") | |
implLine = line | |
if colonIndex is not -1: | |
implLine = line[0:colonIndex] | |
output += implLine.replace("@interface", "@implementation").strip() | |
output += "\n" | |
if line[0] in ("-", "+"): | |
output += "\n" | |
impLine = line.replace(";", "") | |
output += impLine | |
output += "{\n\n}\n\n" | |
if line[0:4] == "@end": | |
output += "@end" | |
print output | |
# Usage | |
# $ python ./stubby.py /path/to/objc/Class.h | |
# For copy/paste, pipe it to pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment