Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.gitignoreを生成する
#!/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
You can’t perform that action at this time.