fix: Show only filename in ls output, not full path

Match AWS S3 CLI behavior where ls shows filenames relative to
the current prefix, not the full S3 path.

Before:
  2024-05-18 20:11:52   73299362 s3://bucket/build/1.57.3/file.zip

After:
  2024-05-18 20:11:52   73299362 file.zip

This matches aws s3 ls behavior exactly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Simone Scarduzio
2025-10-08 13:06:15 +02:00
parent 5b8477ed61
commit a06cc2939c

View File

@@ -306,7 +306,13 @@ def ls(
else:
date_str = obj.last_modified.strftime("%Y-%m-%d %H:%M:%S")
click.echo(f"{date_str} {size_str:>10} s3://{bucket_name}/{obj.key}")
# Show only the filename relative to current prefix (like AWS CLI)
if prefix_str:
display_key = obj.key[len(prefix_str):]
else:
display_key = obj.key
click.echo(f"{date_str} {size_str:>10} {display_key}")
# Show summary if requested
if summarize: