Created
November 11, 2012 09:17
-
-
Save narusemotoki/4054277 to your computer and use it in GitHub Desktop.
.gitignoreを生成する
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 python | |
# -*- coding: utf-8 -*- | |
import sys | |
def android(): | |
""" | |
Android用のgitignoreを書き込みます. | |
""" | |
ignore = """bin/ | |
gen/ | |
""" | |
write(ignore) | |
def python(): | |
""" | |
Python用のgitignoreを書き込みます. | |
""" | |
ignore = """*.pyc | |
""" | |
write(ignore) | |
def write(ignore): | |
""" | |
引数を.gitignoreに書き込みます. | |
""" | |
f = open(".gitignore", "w") | |
f.write(ignore) | |
f.close() | |
def help(): | |
print(u'いずれかを引数で与えてください') | |
print(u'android') | |
print(u'python') | |
if __name__ == '__main__': | |
# 引数が0個か関数名に持っていない値だった場合にヘルプを表示する. | |
if 2 > len(sys.argv) or not sys.argv[1] in dir(): | |
help() | |
else: | |
locals()[sys.argv[1]]() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment