feat(ls): default to show selected paths, --all flag to show all #37
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dccc93ac6b
commit
ebcb0d42c5
@ -415,14 +415,19 @@ def snapshots():
|
||||
|
||||
@cli.command()
|
||||
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
|
||||
@click.option('path', '--path', '-p', envvar='INCLUDE_PATH')
|
||||
def ls(snapshot, path):
|
||||
@click.option('show_all', '--all', '-a', envvar='SHOW_ALL', is_flag=True)
|
||||
@click.argument('path', required=False, default='/')
|
||||
def ls(snapshot, show_all, path):
|
||||
if snapshot == 'latest':
|
||||
latest_snapshot = get_snapshots('latest')
|
||||
if not latest_snapshot:
|
||||
logger.error(f"There is no latest snapshot for {SERVICE}")
|
||||
exit(1)
|
||||
snapshot = latest_snapshot[0]['short_id']
|
||||
if path != '/' and os.environ.get('INCLUDE_PATH'):
|
||||
path = os.environ.get('INCLUDE_PATH')
|
||||
if show_all:
|
||||
path = None
|
||||
results = list_files(snapshot, path)
|
||||
for r in results:
|
||||
if r.get('path'):
|
||||
|
Loading…
x
Reference in New Issue
Block a user