feat: add new fields for the ruler file (#2329)

This commit is contained in:
SPFab authored and GitHub committed 2026-01-11 18:58:37 +01:00
1 parent dd4be21e23
commit 190f5369a2
6 files changed
+34 -7

No files matched your search

+1
View File
@@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- Newline characters are now ignored when drawing the ruler with the `ruler` file configured (#2319).
- A potential crash when using the `scroll-up`/`scroll-down` commands is now fixed (#2320).
- Case-insensitive command-line completions no longer cause user input to be displayed in lowercase (#2336).
- The `ruler` file now supports `.Stat.Extension`, `.Stat.AccessTime`, `.Stat.BirthTime`, `.Stat.ChangeTime` and `.Stat.CustomInfo` (#2329).
## [r40](https://github.com/gokcehan/lf/releases/tag/r40)
+6 -1
View File
@@ -691,7 +691,7 @@ Simulate key pushes given in the argument.
## addcustominfo
Update the `custom` info field of the given file with the given string.
Update the `custom` info and `.Stat.CustomInfo` field of the given file with the given string.
The info string may contain ANSI escape codes to further customize its appearance.
If no info is provided, clear the file's info instead.
@@ -2238,13 +2238,18 @@ The following data fields are exported:
.UserOptions map[string]string The value of user-defined options (e.g. `{{.UserOptions.foo}}`)
.Stat.Path string Path of the current file
.Stat.Name string Name of the current file
.Stat.Extension string Extension of the current file
.Stat.Size uint64 Size of the current file
.Stat.Permissions string Permissions of the current file
.Stat.ModTime string Last modified time of the current file (formatted based on the `timefmt` option)
.Stat.AccessTime string Last access time of the current file (formatted based on the `timefmt` option)
.Stat.BirthTime string Birth time of the current file (formatted based on the `timefmt` option)
.Stat.ChangeTime string Last status (inode) change time of the current file (formatted based on the `timefmt` option)
.Stat.LinkCount string Number of hard links for the current file
.Stat.User string User of the current file
.Stat.Group string Group of the current file
.Stat.Target string Target if the current file is a symbolic link, otherwise a blank string
.Stat.CustomInfo string Custom property if defined via `addcustominfo`, otherwise a blank string
The following functions are exported:
+9 -3
View File
@@ -725,9 +725,10 @@ Simulate key pushes given in the argument.
addcustominfo
Update the custom info field of the given file with the given string.
The info string may contain ANSI escape codes to further customize its
appearance. If no info is provided, clear the file's info instead.
Update the custom info and .Stat.CustomInfo field of the given file with
the given string. The info string may contain ANSI escape codes to
further customize its appearance. If no info is provided, clear the
file's info instead.
calcdirsize
@@ -2512,13 +2513,18 @@ The following data fields are exported:
.UserOptions map[string]string The value of user-defined options (e.g. `{{.UserOptions.foo}}`)
.Stat.Path string Path of the current file
.Stat.Name string Name of the current file
.Stat.Extension string Extension of the current file
.Stat.Size uint64 Size of the current file
.Stat.Permissions string Permissions of the current file
.Stat.ModTime string Last modified time of the current file (formatted based on the `timefmt` option)
.Stat.AccessTime string Last access time of the current file (formatted based on the `timefmt` option)
.Stat.BirthTime string Birth time of the current file (formatted based on the `timefmt` option)
.Stat.ChangeTime string Last status (inode) change time of the current file (formatted based on the `timefmt` option)
.Stat.LinkCount string Number of hard links for the current file
.Stat.User string User of the current file
.Stat.Group string Group of the current file
.Stat.Target string Target if the current file is a symbolic link, otherwise a blank string
.Stat.CustomInfo string Custom property if defined via `addcustominfo`, otherwise a blank string
The following functions are exported:
+8 -3
View File
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.7.0.2
.\"
.TH "LF" "1" "2025\-12\-31" "r41" "DOCUMENTATION"
.TH "LF" "1" "2026\-01\-11" "r41" "DOCUMENTATION"
.SH NAME
lf \- terminal file manager
.SH SYNOPSIS
@@ -688,8 +688,8 @@ Read the configuration file given in the argument.
.SS push
Simulate key pushes given in the argument.
.SS addcustominfo
Update the \f[CR]custom\f[R] info field of the given file with the given
string.
Update the \f[CR]custom\f[R] info and \f[CR].Stat.CustomInfo\f[R] field
of the given file with the given string.
The info string may contain ANSI escape codes to further customize its
appearance.
If no info is provided, clear the file\(aqs info instead.
@@ -2548,13 +2548,18 @@ The following data fields are exported:
\&.UserOptions map[string]string The value of user\-defined options (e.g. \(ga{{.UserOptions.foo}}\(ga)
\&.Stat.Path string Path of the current file
\&.Stat.Name string Name of the current file
\&.Stat.Extension string Extension of the current file
\&.Stat.Size uint64 Size of the current file
\&.Stat.Permissions string Permissions of the current file
\&.Stat.ModTime string Last modified time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.AccessTime string Last access time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.BirthTime string Birth time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.ChangeTime string Last status (inode) change time of the current file (formatted based on the \(gatimefmt\(ga option)
\&.Stat.LinkCount string Number of hard links for the current file
\&.Stat.User string User of the current file
\&.Stat.Group string Group of the current file
\&.Stat.Target string Target if the current file is a symbolic link, otherwise a blank string
\&.Stat.CustomInfo string Custom property if defined via \(gaaddcustominfo\(ga, otherwise a blank string
.EE
.PP
The following functions are exported:
+5
View File
@@ -16,13 +16,18 @@ var gDefaultRuler string
type statData struct {
Path string
Name string
Extension string
Size uint64
Permissions string
ModTime string
AccessTime string
BirthTime string
ChangeTime string
LinkCount string
User string
Group string
Target string
CustomInfo string
}
type rulerData struct {
+5
View File
@@ -1028,13 +1028,18 @@ func (ui *ui) drawRulerFile(nav *nav) {
stat = &statData{
Path: curr.path,
Name: curr.Name(),
Extension: curr.ext,
Size: uint64(curr.Size()),
Permissions: permString(curr.Mode()),
ModTime: curr.ModTime().Format(gOpts.timefmt),
AccessTime: curr.accessTime.Format(gOpts.timefmt),
BirthTime: curr.birthTime.Format(gOpts.timefmt),
ChangeTime: curr.changeTime.Format(gOpts.timefmt),
LinkCount: linkCount(curr),
User: userName(curr),
Group: groupName(curr),
Target: curr.linkTarget,
CustomInfo: curr.customInfo,
}
} else {
ui.echoerrf("stat: %s", curr.err)