示例#1
0
def do_open(client, args):
    """Create a new issue."""
    repository = get_working_repo(client, args.repository)
    print('Please enter the long description for this issue.')
    print('Starting your text editor:')
    desc_text = text_from_editor()
    repository.create_issue(args.title, body=desc_text)
示例#2
0
文件: issues.py 项目: CMB/cligh
def do_open(client, args):
    """Create a new issue."""
    repository = get_working_repo(client, args.repository)
    print('Please enter the long description for this issue.')
    print('Starting your text editor:')
    desc_text = text_from_editor()
    repository.create_issue(args.title, body=desc_text)
示例#3
0
文件: repos.py 项目: eamanu/cligh
def remlabel(client, args):
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
        label.delete()
    except GithubException as e:
        die('''Unable to delete label %s from this repository.
Error message: %s
''' % (args.label, e.data['message']))
    print('Label removed.')
示例#4
0
文件: repos.py 项目: CMB/cligh
def remlabel(client, args):
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
        label.delete()
    except GithubException as e:
        die('''Unable to delete label %s from this repository.
Error message: %s
''' % (args.label, e.data['message']))
    print('Label removed.')
示例#5
0
def remlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        die('''Unable to find the label %s in this repository.
            It cannot be removed from the issue at this time.
            Error message: %s
            ''' % (args.label, e.data['message']))
    issue.remove_from_labels(label)
示例#6
0
文件: issues.py 项目: CMB/cligh
def remlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        die('''Unable to find the label %s in this repository.
            It cannot be removed from the issue at this time.
            Error message: %s
            ''' % (args.label, e.data['message']))
    issue.remove_from_labels(label)
示例#7
0
文件: issues.py 项目: CMB/cligh
def do_list(client, args):
    """Command to list the issues for a given repository."""
    repository = get_working_repo(client, args.repository)
    status = args.status or 'open'
    issues = list(repository.get_issues(state=status))
    if not issues:
        print('%s has no %s issues' % (repository.full_name, status))
    else:
        print('%s has the following %s issues' % (repository.full_name, status))
        print('Issue# - Title')
    for issue in issues:
        print('%s - %s' % (issue.number, issue.title))
示例#8
0
文件: repos.py 项目: eamanu/cligh
def addlabel(client, args):
    # xxx Make this configurable by the user.  White is a sane
    # default, for now.
    color = 'ffffff'
    repository = get_working_repo(client, args.repository)
    try:
        repository.create_label(args.label, color)
    except GithubException as e:
        die('''Unable to create label %s.
The complete error response was:
%s
''' % (args.label, e.data))
    print('Label added.')
示例#9
0
def do_list(client, args):
    """Command to list the issues for a given repository."""
    repository = get_working_repo(client, args.repository)
    status = args.status or 'open'
    issues = list(repository.get_issues(state=status))
    if not issues:
        print('%s has no %s issues' % (repository.full_name, status))
    else:
        print('%s has the following %s issues' %
              (repository.full_name, status))
        print('Issue# - Title')
    for issue in issues:
        print('%s - %s' % (issue.number, issue.title))
示例#10
0
文件: repos.py 项目: CMB/cligh
def addlabel(client, args):
    # xxx Make this configurable by the user.  White is a sane
    # default, for now.
    color = 'ffffff'
    repository = get_working_repo(client, args.repository)
    try:
        repository.create_label(args.label, color)
    except GithubException as e:
        die('''Unable to create label %s.
The complete error response was:
%s
''' % (args.label, e.data))
    print('Label added.')
示例#11
0
文件: issues.py 项目: CMB/cligh
def get_working_issue(client, args):
    """Get an object corresponding to the issue
    that the user wishes to manipulate.  Issues are identified by
    a repository name and issue number."""
    issue = None
    repository = get_working_repo(client, args.repository)
    try:
        issue_number = int(args.number)
    except ValueError:
        die("""%s is not a valid issue number.""" % args.number)
    try:
        issue = repository.get_issue(issue_number)
    except GithubException as e:
        die('Unable to fetch issue number %d for this repository: %s' % (issue_number, e.data['message']))
    return issue
示例#12
0
def get_working_issue(client, args):
    """Get an object corresponding to the issue
    that the user wishes to manipulate.  Issues are identified by
    a repository name and issue number."""
    issue = None
    repository = get_working_repo(client, args.repository)
    try:
        issue_number = int(args.number)
    except ValueError:
        die("""%s is not a valid issue number.""" % args.number)
    try:
        issue = repository.get_issue(issue_number)
    except GithubException as e:
        die('Unable to fetch issue number %d for this repository: %s' %
            (issue_number, e.data['message']))
    return issue
示例#13
0
文件: issues.py 项目: CMB/cligh
def addlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        if e.status == 404:
            die('''The label %s has not yet been added to this repository.
First, add it using:
cligh repo addlabel %s
''' % (args.label, args.label))
        else:
            die('''Unable to find the label %s in this repository.
Error message: %s
''' % (args.label, e.data['message']))

    issue.add_to_labels(label)
示例#14
0
def addlabel(client, args):
    issue = get_working_issue(client, args)
    repository = get_working_repo(client, args.repository)
    try:
        label = repository.get_label(args.label)
    except GithubException as e:
        if e.status == 404:
            die('''The label %s has not yet been added to this repository.
First, add it using:
cligh repo addlabel %s
''' % (args.label, args.label))
        else:
            die('''Unable to find the label %s in this repository.
Error message: %s
''' % (args.label, e.data['message']))

    issue.add_to_labels(label)
示例#15
0
文件: repos.py 项目: CMB/cligh
def delete(client, args):
    """Delete a repository."""
    repository = get_working_repo(client, args.repository)
    repository.delete()
    print('Repository %s deleted.' % repository.full_name)
示例#16
0
文件: repos.py 项目: eamanu/cligh
def delete(client, args):
    """Delete a repository."""
    repository = get_working_repo(client, args.repository)
    repository.delete()
    print('Repository %s deleted.' % repository.full_name)
示例#17
0
文件: repos.py 项目: eamanu/cligh
def fork(client, args):
    """Fork a repository."""
    repo_to_fork = get_working_repo(client, args.repository)
    client.get_user().create_fork(repo_to_fork)
    print('Repository forked.')
示例#18
0
文件: repos.py 项目: CMB/cligh
def fork(client, args):
    """Fork a repository."""
    repo_to_fork = get_working_repo(client, args.repository)
    client.get_user().create_fork(repo_to_fork)
    print('Repository forked.')