feat(ls): add --timestamps flag #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
14b55bbc79
commit
141bedb069
@ -416,8 +416,9 @@ def snapshots():
|
||||
@cli.command()
|
||||
@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/')
|
||||
def ls(snapshot, show_all, path):
|
||||
def ls(snapshot, show_all, timestamps, path):
|
||||
if snapshot == 'latest':
|
||||
latest_snapshot = get_snapshots('latest')
|
||||
if not latest_snapshot:
|
||||
@ -431,7 +432,10 @@ def ls(snapshot, show_all, path):
|
||||
results = list_files(snapshot, path)
|
||||
for r in results:
|
||||
if r.get('path'):
|
||||
print(f"{r['ctime']}\t{r['path']}")
|
||||
if timestamps:
|
||||
print(f"{r['ctime']}\t{r['path']}")
|
||||
else:
|
||||
print(f"{r['path']}")
|
||||
|
||||
|
||||
def list_files(snapshot, path):
|
||||
|
Loading…
x
Reference in New Issue
Block a user