refactor(ls): INCLUDE_PATH parsing via click
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
4b4371ed3f
commit
f1661c04e7
@ -455,7 +455,7 @@ def snapshots():
|
|||||||
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
|
@click.option('snapshot', '--snapshot', '-s', envvar='SNAPSHOT', default='latest')
|
||||||
@click.option('show_all', '--all', '-a', envvar='SHOW_ALL', is_flag=True)
|
@click.option('show_all', '--all', '-a', envvar='SHOW_ALL', is_flag=True)
|
||||||
@click.option('timestamps', '--timestamps', '-t', envvar='TIMESTAMPS', 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):
|
def ls(snapshot, show_all, timestamps, path):
|
||||||
if snapshot == 'latest':
|
if snapshot == 'latest':
|
||||||
latest_snapshot = get_snapshots('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}")
|
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 os.environ.get('INCLUDE_PATH'):
|
|
||||||
path = os.environ.get('INCLUDE_PATH')
|
|
||||||
if show_all:
|
if show_all:
|
||||||
path = None
|
path = None
|
||||||
results = list_files(snapshot, path)
|
results = list_files(snapshot, path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user