project-stats

keep track of your projects
git clone https://git.ce9e.org/project-stats.git

commit
5e94b98910479678f5645d1cfa025fa959f38f32
parent
3723867d220acadff7ca18384b17a034e18e34a1
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2015-04-14 06:41
try more congi files

Diffstat

M project_stats.py 26 ++++++++++++++++++++++----

1 files changed, 22 insertions, 4 deletions


diff --git a/project_stats.py b/project_stats.py

@@ -10,6 +10,7 @@ import logging
   10    10 import os
   11    11 import re
   12    12 import subprocess
   -1    13 import sys
   13    14 
   14    15 from dateutil import parser as dt
   15    16 from filecachetools import ttl_cache
@@ -319,6 +320,25 @@ def get_travis(url):
  319   320     }
  320   321 
  321   322 
   -1   323 def select_config(args):
   -1   324     if args.config is not None:
   -1   325         return os.path.expanduser(args.config)
   -1   326     else:
   -1   327         choices = [
   -1   328             os.path.abspath('./projects.yml'),
   -1   329             os.path.abspath('./.projects.yml'),
   -1   330             os.path.expanduser('~/.config/projects.yml'),
   -1   331             os.path.expanduser('~/.projects.yml'),
   -1   332         ]
   -1   333 
   -1   334         for path in choices:
   -1   335             if os.path.exists(path):
   -1   336                 return path
   -1   337 
   -1   338         print('No config file available. Tried %s.' % ', '.join(choices))
   -1   339         sys.exit(1)
   -1   340 
   -1   341 
  322   342 def load_config(path):
  323   343     with open(path) as fh:
  324   344         return yaml.load(fh)
@@ -335,9 +355,7 @@ def parse_args():
  335   355         '-s', '--short',
  336   356         action='store_true',
  337   357         help='show only basic stats')
  338    -1     parser.add_argument(
  339    -1         '-c', '--config',
  340    -1         default='projects.yml')
   -1   358     parser.add_argument('-c', '--config')
  341   359     parser.add_argument(
  342   360         '-z', '--sort',
  343   361         help='sort by key')
@@ -374,7 +392,7 @@ def get_projects(projects_config):
  374   392 
  375   393 def main():
  376   394     args = parse_args()
  377    -1     config = load_config(os.path.expanduser(args.config))
   -1   395     config = load_config(select_config(args))
  378   396 
  379   397     keys = config['projects'].keys()
  380   398     if args.query is not None: