add -s to just have the count

This commit is contained in:
Davide Alberani 2017-10-15 11:18:24 +02:00
parent d22ea9a0d6
commit f4e6cdf0d0

View file

@ -5,7 +5,7 @@ import sys
import monco
def info(event, key):
def info(event, key, short=False):
tickets = event['tickets']
data = {}
for ticket in tickets:
@ -19,7 +19,10 @@ def info(event, key):
for key, value in data.items():
if len(value) < 2:
continue
print('%s : %s' % (key, ', '.join(value)))
output = '%s (%d persons)' % (key, len(value))
if not short:
output += ': %s' % ', '.join(value)
print(output)
print('')
@ -27,7 +30,7 @@ def run():
try:
db = monco.Monco(dbName='eventman')
events = db.query('events', {'title': sys.argv[1]})
info(events[0], sys.argv[2])
info(events[0], sys.argv[2], short='-s' in sys.argv[1:])
except:
print('duplicates.py "title of event" key')
sys.exit(1)