refactor(ls): INCLUDE_PATH parsing via click
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Moritz 2024-10-28 17:01:52 +01:00
parent 4b4371ed3f
commit f1661c04e7

View File

@ -455,7 +455,7 @@ def snapshots():
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
@click.option('show_all', '--all', '-a', envvar='SHOW_ALL', is_flag=True)
@click.option('timestamps', '--timestamps', '-t', envvar='TIMESTAMPS', is_flag=True)
@click.argument('path', required=False, default='/var/lib/docker/volumes/')
@click.argument('path', required=False, default='/var/lib/docker/volumes/', envvar='INCLUDE_PATH')
def ls(snapshot, show_all, timestamps, path):
if snapshot == 'latest':
latest_snapshot = get_snapshots('latest')
@ -463,8 +463,6 @@ def ls(snapshot, show_all, timestamps, path):
logger.error(f"There is no latest snapshot for {SERVICE}")
exit(1)
snapshot = latest_snapshot[0]['short_id']
if os.environ.get('INCLUDE_PATH'):
path = os.environ.get('INCLUDE_PATH')
if show_all:
path = None
results = list_files(snapshot, path)