Skip to content

feat(ls): add --metadata flag to preserve permissions, sizes, and dates - #1175

Closed
iRonin wants to merge 1 commit into
rtk-ai:developfrom
iRonin:feat/ls-metadata-preservation
Closed

iRonin wants to merge 1 commit into
rtk-ai:developfrom
iRonin:feat/ls-metadata-preservation

Conversation

@iRonin

@iRonin iRonin commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Add --metadata (-m) flag to the ls command that preserves file permissions, sizes, dates, and other metadata in the compact output.

Changes

  • src/main.rs: Added --metadata (-m) flag to the Ls command
  • src/cmds/system/ls.rs:
    • Extended compact_ls to parse and store permissions, dates, and sizes
    • When metadata mode is on, each entry appends metadata like (1.2K, Jan 15, -rw-r--r--)
    • Auto-detects -l flag in args and enables metadata mode automatically
    • Added 5 new tests for metadata functionality

Example

# Normal mode (default)
rtk ls
src/
Cargo.toml  1.2K
README.md   5.5K

# Metadata mode
rtk ls -m
src/  (64B, Jan 1 12:00, drwxr-xr-x)
Cargo.toml  1.2K  (Jan 1 12:00, -rw-r--r--)
README.md   5.5K  (Jan 1 12:00, -rw-r--r--)

# Auto-enabled with -l
rtk ls -la  # automatically uses metadata mode

Fixes #1162

@iRonin
iRonin changed the base branch from master to develop April 10, 2026 13:10
@iRonin
iRonin force-pushed the feat/ls-metadata-preservation branch 2 times, most recently from a839d59 to aeafdc8 Compare April 10, 2026 17:54
@iRonin
iRonin force-pushed the feat/ls-metadata-preservation branch from aeafdc8 to fc9d83d Compare April 16, 2026 13:00
@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@rtk-release-bot rtk-release-bot Bot added the stale label Sep 3, 2026
@KuSh

KuSh commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this. Metadata in rtk ls landed on develop through #1675 on 2026-05-25, which detects the long listing automatically from -l and also from -g, -n, -o, --full-time and --format=long or verbose, and renders permissions as octal next to the size, so the explicit -m flag is no longer needed. One thing this PR had that develop does not is the modification date in the compact listing, and a small PR adding the date to the existing long mode would be welcome. Worth noting the parsing here goes back to fixed whitespace columns, which is what #1675 replaced with a date-anchored parser so that owner and group names containing spaces do not shift the size and filename fields. If you think part of this was missed, please comment or reopen.

@KuSh KuSh closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhancement: ls filter removes file metadata (permissions, sizes, dates) needed by agents

2 participants