ここにある.gitignoreを取得します.https://github.com/github/gitignore
続きはソースコードです.Pythonです.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import urllib2
def write(ignore):
"""
引数を.gitignoreに書き込みます.
"""
f = open(".gitignore", "w")
f.write(ignore)
f.close()
def help():
print(u'引数でAndroidやDjangoを与えてください.')
print(u'https://github.com/github/gitignore に対応しています.')
if __name__ == '__main__':
# 引数が0個の場合にヘルプを表示する.
if 2 > len(sys.argv):
help()
else:
try:
url = 'https://raw.github.com/github/gitignore/master/' + sys.argv[1] + '.gitignore'
res = urllib2.urlopen(url)
except urllib2.URLError, e:
print(u'error: ' + str(e.code))
else:
write(res.read())
print(u'完了しました')
Gist https://gist.github.com/4054341
0 件のコメント:
コメントを投稿