예제 #1
0
파일: display.py 프로젝트: lorneliechty/ghi
 def getOneLineStr(self, columns):
     from groups.group import getGroupsForIssueId
     line = ""
     for column in columns:
         color = str(column.color)
         field = "" 
         if column.name == 'id':
             field = self.getShortIdStr()
         elif column.name == 'status':
             field = self.getStatusStr()
         elif column.name == 'title':
             field = self.getTitle()
         elif column.name == 'cdate':
             field = self.getCreatedDateStr()
         elif column.name == 'mdate':
             field = self.getModifiedDateStr()
         elif column.name == 'groups':
             field = ', '.join(getGroupsForIssueId(self.getIdStr()))
         
         line += color + truncateOrPadStrToWidth(field, column.length) + '  '
             
     return line
예제 #2
0
파일: ls.py 프로젝트: lorneliechty/ghi
def execute(args):
    issueIDs = _getFilteredListofIssueIDs(args)
    if issueIDs == None:
        print "Could not find issue: " + args.id
        return
    
    elif len(issueIDs) == 1:
        print IssueDisplayBuilder(issueIDs[0]).getFullIssueDisplay()
            
    else:
        columns = [display.COLUMNS['id'],
                   display.COLUMNS['status'],
                   display.COLUMNS['groups'],
                   display.COLUMNS['title'],
                   display.COLUMNS['mdate']]
        
        # We may have a lot of issues in the list that would make the output
        # run pretty long, therefore page it.
        PageOutputBeyondThisPoint()
        
        header = '  '.join([truncateOrPadStrToWidth(col.name, col.length) for col in columns])
        print header
        print '-' * len(header)        

        # Any sorting required?
        if args.sort != None:
            issueIDs = _sortIssues(issueIDs, args.sort)
            
        # Check to see if a default issue sort has been configured for this repository
        else:
            sort = getCmd('git config issue.ls.sort')
            if sort != None:
                issueIDs = _sortIssues(issueIDs, sort)

        # Group arg can be passed as parameter or via configured default
        if args.group or getCmd('git config issue.ls.group') == 'true':
            _displayGrouped(issueIDs, columns)        
        else:
            _displayUnGrouped(issueIDs, columns)