basic cli added
This commit is contained in:
32
gitfiti.py
32
gitfiti.py
@ -48,7 +48,7 @@ hackerschool=[
|
|||||||
[4,1,3,3,3,4],
|
[4,1,3,3,3,4],
|
||||||
[4,3,3,3,3,4],
|
[4,3,3,3,3,4],
|
||||||
[4,4,4,4,4,4],
|
[4,4,4,4,4,4],
|
||||||
[0,0,4,4,0,0]
|
[0,0,4,4,0,0],
|
||||||
[4,4,4,4,4,4]]
|
[4,4,4,4,4,4]]
|
||||||
|
|
||||||
octocat=[
|
octocat=[
|
||||||
@ -69,6 +69,16 @@ hireme=[
|
|||||||
[2,0,2,0,2,0,2,0,0,0,2,0,0,0,0,2,0,2,0,2,0,2,0,0],
|
[2,0,2,0,2,0,2,0,0,0,2,0,0,0,0,2,0,2,0,2,0,2,0,0],
|
||||||
[1,0,1,0,1,0,1,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1,1,1]]
|
[1,0,1,0,1,0,1,0,0,0,1,1,1,0,0,1,0,1,0,1,0,1,1,1]]
|
||||||
|
|
||||||
|
images={
|
||||||
|
'kitty':kitty,
|
||||||
|
'oneup':oneup,
|
||||||
|
'twoup':twoup,
|
||||||
|
'hello':hello,
|
||||||
|
'hackerschool':hackerschool,
|
||||||
|
'octocat':octocat,
|
||||||
|
'hireme':hireme
|
||||||
|
}
|
||||||
|
|
||||||
def get_calendar(username):
|
def get_calendar(username):
|
||||||
"""retrieves the github commit calendar data for a username"""
|
"""retrieves the github commit calendar data for a username"""
|
||||||
BASEURL='https://github.com/'
|
BASEURL='https://github.com/'
|
||||||
@ -123,24 +133,24 @@ def commit(content, commitdate):
|
|||||||
|
|
||||||
def fake_it(image, start_date, username, repo, offset=0, multiplier=1):
|
def fake_it(image, start_date, username, repo, offset=0, multiplier=1):
|
||||||
template = ('#!/bin/bash\n'
|
template = ('#!/bin/bash\n'
|
||||||
'git init gitfiti\n'
|
'REPO=%s\n'
|
||||||
'cd gitfiti\n'
|
'git init $"REPO"\n'
|
||||||
|
'cd $"REPO"\n'
|
||||||
'touch gitfiti\n'
|
'touch gitfiti\n'
|
||||||
'git add gitfiti\n'
|
'git add gitfiti\n'
|
||||||
'%s\n'
|
'%s\n'
|
||||||
'git remote add origin git@github.com:%s/%s.git\n'
|
'git remote add origin git@github.com:%s/$"REPO".git\n'
|
||||||
'git pull\n'
|
'git pull\n'
|
||||||
'git push -u origin master\n')
|
'git push -u origin master\n')
|
||||||
strings = []
|
strings = []
|
||||||
for value, date in zip(values_in_date_order(image, multiplier), date_gen(start_date, offset)):
|
for value, date in zip(values_in_date_order(image, multiplier), date_gen(start_date, offset)):
|
||||||
for i in range(value):
|
for i in range(value):
|
||||||
strings.append(commit(i, date))
|
strings.append(commit(i, date))
|
||||||
return template % ("".join(strings), username, repo)
|
return template % (repo, "".join(strings), username)
|
||||||
|
|
||||||
def save(output, filename):
|
def save(output, filename):
|
||||||
"""Saves the list to a given filename"""
|
"""Saves the list to a given filename"""
|
||||||
f = open(filename, "w")
|
f = open(filename, "w")
|
||||||
f.write('\n')
|
|
||||||
f.write(output)
|
f.write(output)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
@ -155,6 +165,16 @@ def main():
|
|||||||
|
|
||||||
print 'enter weeks to offset the image:'
|
print 'enter weeks to offset the image:'
|
||||||
offset = raw_input(">")
|
offset = raw_input(">")
|
||||||
|
if offset == None: offset = 0
|
||||||
|
else: offset = int(offset)
|
||||||
|
|
||||||
|
print 'enter the image name to gitfiti'
|
||||||
|
print 'images: ' + ", ".join(images.keys())
|
||||||
|
image = raw_input(">")
|
||||||
|
if image == None: image = images['kitty']
|
||||||
|
else:
|
||||||
|
try: image = images[image]
|
||||||
|
except: image = images['kitty']
|
||||||
|
|
||||||
output = fake_it(image, get_start_date(), username, repo, offset, m)
|
output = fake_it(image, get_start_date(), username, repo, offset, m)
|
||||||
save(output, 'gitfiti.sh')
|
save(output, 'gitfiti.sh')
|
||||||
|
Reference in New Issue
Block a user