コード例 #1
0
ファイル: ls.py プロジェクト: wml/evolve
  def ls(self, repo, path):
    (target, children) = repo.get_directory_contents(path)
    children = interleave_tuples(children)

    path = path.strip().strip('/')
    if '' == path: path = '/'

    print
    print '  Path:                ' + path
    for attr in target:
      print '  %-20.20s %s' % (attr[0] + ':', attr[1])

    if 0 < len(children):
      print '  Child Count:         ' + str(len(children))
      print
      print '  Children'
      print '  +' + '-' * 76 + '+'
      columnize_best_fit(
        '  | ',
        80,
          [tuple(['Name'] + [k for k,v in children[children.keys()[0]]])]
        + [
          tuple([c[0]] + [v for k,v in c[1]])
          for c in sorted(children.iteritems())
        ],
        newline=False,
        sep = ' | ',
        suffix = ' |',
        header = True
      )
      print '  +' + '-' * 76 + '+'
    
    # TODO: print dependencies

    print
コード例 #2
0
ファイル: history.py プロジェクト: wml/evolve
 def __call__(self, options, path=''):
   history = Repository(options.repo).get_history(path)
   print
   print '  +' + '-' * 76 + '+'
   columnize_best_fit(
     '  | ',
     80,
       [('Target', 'Modified By', 'Last Modified')]
     + [(h[0], h[1], ctime(h[2])) for h in history],
     newline=False,
     sep = ' | ',
     suffix = ' |',
     header = True
   )
   print '  +' + '-' * 76 + '+'
   print