Skip to content

Commit

Permalink
Status command: show git subdirectory type and a catchall for others
Browse files Browse the repository at this point in the history
  • Loading branch information
jfischer committed Apr 14, 2019
1 parent 40863a7 commit 9d9b26a
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions dataworkspaces/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,30 @@ def pretty(self, rsrc, indent=2):
click.echo(' '*indent, nl=False)
click.echo('git repo %s' % rsrc['name'])
if self.verbose:
click.echo(' '*(indent+2)+ ('Remote=%s' % rsrc['remote_origin_url']))
click.echo(' '*(indent+2)+ ('Remote: %s' % rsrc['remote_origin_url']))
return
if rsrc['resource_type'] == 'file':
elif rsrc['resource_type'] == 'git-subdirectory':
click.echo(' '*indent, nl=False)
click.echo('git subdirectory %s' % rsrc['name'])
if self.verbose:
click.echo(' '*(indent+2)+ ('Relative path: %s' % rsrc['relative_path']))
return
elif rsrc['resource_type'] == 'file':
click.echo(' '*indent, nl=False)
click.echo('local files %s' % rsrc['name'])
if self.verbose:
click.echo(' '*(indent+2), nl=False)
click.echo('LocalPath=%s' % rsrc['local_path'])
click.echo('LocalPath: %s' % rsrc['local_path'])
return
else:
click.echo(' '*indent, nl=False)
click.echo("%s %s" % (rsrc['resource_type'], rsrc['name']))
if self.verbose:
for p in rsrc.keys():
if p in ['resource_type', 'name']:
continue
click.echo(' '*(indent+2), nl=False)
click.echo("%s: %s" % (p, rsrc[p]))

def run(self):
with open(self.resource_file, 'r') as f:
Expand All @@ -123,7 +138,9 @@ def run(self):
for e in items[r]:
self.pretty(e, indent=2)
else:
click.echo('No items with role %s' % r)
click.echo('Role %s' % r)
click.echo('-' *(5+len(r)))
click.echo(' No items with role %s' % r)


def __str__(self):
Expand Down

0 comments on commit 9d9b26a

Please sign in to comment.