Ejemplo n.º 1
0
def do_open(client, args):
	"""Create a new issue."""
	repository = get_repository_name(args.repository)
	print 'Please enter the long description for this issue.'
	print 'Starting your text editor:'
	desc_text = text_from_editor()
	print client.issues.open(repository, args.title, desc_text)
Ejemplo n.º 2
0
def do_list(client, args):
	"""List a repository's collaborators."""
	repository = get_repository_name(args.repository)
	collaborators = client.repos.list_collaborators(repository)
	if not collaborators:
		print 'There are no collaborators for %s.' % repository
	else:
		print 'The following people are collaborating on %s:' % \
			repository
		for collaborator in collaborators:
			print collaborator
Ejemplo n.º 3
0
def do_list(client, args):
	"""Command to list the issues for a given repository."""
	repository = get_repository_name(args.repository)
	status = args.status or 'open'
	issues = client.issues.list(repository, state=status)
	if not issues:
		print '%s has no %s issues' % (repository, status)
	else:
		print '%s has the following %s issues' % (repository, status)
		print 'Issue# - Title'
	for issue in issues:
		print '%s - %s' % (issue.number, issue.title)
Ejemplo n.º 4
0
def get(client, args):
	repository = get_repository_name(args.repository)
	try:
		issue = client.issues.show(repository, args.number)
		comments = client.issues.comments(repository, args.number)
	except:
		die(
"""Unable to retrieve the issue because of the following error:
%s: %s
""" % (sys.exc_info()[0], sys.exc_info()[1]))
	print 'Issue #%d: %s' % (issue.number, issue.title)
	print 'Opened by %s on %s at %s' % (issue.user, issue.created_at.date(),
		issue.created_at.strftime('%H:%M:%S'))
	print 'Last updated on %s at %s' % (issue.updated_at.date(),
		issue.updated_at.strftime('%H:%M:%S'))
	if issue.labels:
		print 'Labels:'
		for label in issue.labels:
			print '* %s' % label
	print 'Long description:'
	print_enclosed_text(issue.body)
	if comments:
		for comment in comments:
			print_comment(comment)
Ejemplo n.º 5
0
def remlabel(client, args):
	repository = get_repository_name(args.repository)
	print client.issues.remove_label(repository, args.number, args.label)
Ejemplo n.º 6
0
def comment(client, args):
	repository = get_repository_name(args.repository)
	print 'Starting your text editor, so that you can compose your comment:'
	comment_text = text_from_editor()
	print client.issues.comment(repository, args.number, comment_text)
Ejemplo n.º 7
0
def close(client, args):
	"""Close an existing open issue."""
	repository = get_repository_name(args.repository)
	print client.issues.close(repository, args.number)
Ejemplo n.º 8
0
def add(client, args):
	"""Add a collaborator to a repo."""
	repository = get_repository_name(args.repository)
	repository = remove_username(repository)
	print client.repos.add_collaborator(repository, args.user)
Ejemplo n.º 9
0
def remove(client, args):
	"""Remove a collaborator from a repo."""
	repository = get_repository_name(args.repository)
	repository = remove_username(repository)
	print client.repos.remove_collaborator(repository, args.user)