Skip to content

Commit 08a6bd0

Browse files
committed
Support searching tickets by status
1 parent 6967e6b commit 08a6bd0

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

‎bin/codebase‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ if __name__ == "__main__":
1616
1. project name
1717
2. api function name
1818
3. args to pass to the api function
19+
20+
Search:
21+
22+
codebase my_project search "status:code complete"
1923
"""
2024
if len(sys.argv) == 1:
2125
# if no args then print available API methods
26+
print 'Available commands:\n'
2227
for name in dir(CodeBaseAPI):
2328
if name[0] != '_' and name[0].islower():
24-
print name
29+
print '\t' + name
30+
print
2531
else:
2632
# make the API call
2733
# TODO use something more sensible like argparse
@@ -38,5 +44,13 @@ if __name__ == "__main__":
3844
project=project,
3945
)
4046

41-
response = getattr(codebase, command)(*args)
42-
pprint.pprint(response)
47+
kwargs = {}
48+
if args and command == 'search' and ':' in args[0]:
49+
k, v = args[0].split(':')
50+
kwargs[k] = v
51+
response = getattr(codebase, command)(**kwargs)
52+
for ticket in response:
53+
print '{ticket_id} {summary}'.format(**ticket['ticket'])
54+
else:
55+
response = getattr(codebase, command)(*args, **kwargs)
56+
pprint.pprint(response)

0 commit comments

Comments
 (0)