add option to save graph to a file

This commit is contained in:
Frédéric Péters 2017-10-14 18:53:14 +02:00
parent 519c0abc88
commit 34cbd3720a
1 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,7 @@ class GraphCommand(BaseCommand):
parser.add_argument('--datemax', metavar='DATEMAX')
parser.add_argument('--committime', action='store_true',
help='use commit datetime instead of author datetime')
parser.add_argument('--filename', metavar='FILENAME')
def get_commits(self, options):
filters = {'author_email__endswith': '@entrouvert.com'}
@ -41,4 +42,7 @@ class GraphCommand(BaseCommand):
def plot(self, options):
plt.title(self.get_title(options))
plt.show()
if options.get('filename'):
plt.savefig(options['filename'])
else:
plt.show()