-
Notifications
You must be signed in to change notification settings - Fork 1
/
repochart_cli.py
31 lines (24 loc) · 937 Bytes
/
repochart_cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
import re
import time
from optparse import OptionParser
from models.repo_chart import RepoChart
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('-r', '--repo', dest='repo',
help="clone repo and get repo charts.")
parser.add_option('-v', '--version', action="store", help="Repo Chart v1.0.0")
options = parser.parse_args()[0]
if not options.repo:
print('Need option, exit.')
exit()
current_time = time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime())
print('start time: ' + current_time)
if not re.match(".+/.+", options.repo):
print('Error: this repo is not exist on Github.')
exit()
repo_name = options.repo.split('/')
repo = RepoChart(repo_name[0], repo_name[1])
repo.output()
current_time = time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime())
print('end time: ' + current_time)