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()
|
@cli.command()
|
||||||
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
|
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
|
||||||
@click.option('path', '--path', '-p', envvar='INCLUDE_PATH')
|
@click.option('show_all', '--all', '-a', envvar='SHOW_ALL', is_flag=True)
|
||||||
def ls(snapshot, path):
|
@click.argument('path', required=False, default='/')
|
||||||
|
def ls(snapshot, show_all, path):
|
||||||
if snapshot == 'latest':
|
if snapshot == 'latest':
|
||||||
latest_snapshot = get_snapshots('latest')
|
latest_snapshot = get_snapshots('latest')
|
||||||
if not latest_snapshot:
|
if not latest_snapshot:
|
||||||
logger.error(f"There is no latest snapshot for {SERVICE}")
|
logger.error(f"There is no latest snapshot for {SERVICE}")
|
||||||
exit(1)
|
exit(1)
|
||||||
snapshot = latest_snapshot[0]['short_id']
|
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)
|
results = list_files(snapshot, path)
|
||||||
for r in results:
|
for r in results:
|
||||||
if r.get('path'):
|
if r.get('path'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user