Skip to content

Instantly share code, notes, and snippets.

@narusemotoki
Created November 11, 2012 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save narusemotoki/4054277 to your computer and use it in GitHub Desktop.
Save narusemotoki/4054277 to your computer and use it in GitHub Desktop.
.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