Add statfmt option (#1288)
* Add `fileinfofmt` option * echof is now unused * Use different default for Windows * Add new line to docs * Indent placeholders description in documentation * Change option name to `statfmt` * Use plain text format for documentation
This commit is contained in:
1 parent
59f32193ae
commit
2ab4b14e88
9 files changed
+50
-17
No files matched your search
@@ -648,10 +648,6 @@ func (ui *ui) echo(msg string) {
|
||||
ui.msg = msg
|
||||
}
|
||||
|
||||
func (ui *ui) echof(format string, a ...interface{}) {
|
||||
ui.echo(fmt.Sprintf(format, a...))
|
||||
}
|
||||
|
||||
func (ui *ui) echomsg(msg string) {
|
||||
ui.msg = msg
|
||||
log.Print(msg)
|
||||
@@ -722,19 +718,21 @@ func (ui *ui) loadFileInfo(nav *nav) {
|
||||
return
|
||||
}
|
||||
|
||||
var linkTarget string
|
||||
linkTargetArrow := ""
|
||||
if curr.linkTarget != "" {
|
||||
linkTarget = " -> " + curr.linkTarget
|
||||
linkTargetArrow = "-> " + curr.linkTarget
|
||||
}
|
||||
|
||||
ui.echof("%v %v%v%v%4s %v%s",
|
||||
curr.Mode(),
|
||||
linkCount(curr), // optional
|
||||
userName(curr), // optional
|
||||
groupName(curr), // optional
|
||||
humanize(curr.Size()),
|
||||
curr.ModTime().Format(gOpts.timefmt),
|
||||
linkTarget)
|
||||
fileInfo := gOpts.statfmt
|
||||
fileInfo = strings.Replace(fileInfo, "%p", curr.Mode().String(), -1)
|
||||
fileInfo = strings.Replace(fileInfo, "%c", linkCount(curr), -1)
|
||||
fileInfo = strings.Replace(fileInfo, "%u", userName(curr), -1)
|
||||
fileInfo = strings.Replace(fileInfo, "%g", groupName(curr), -1)
|
||||
fileInfo = strings.Replace(fileInfo, "%s", humanize(curr.Size()), -1)
|
||||
fileInfo = strings.Replace(fileInfo, "%t", curr.ModTime().Format(gOpts.timefmt), -1)
|
||||
fileInfo = strings.Replace(fileInfo, "%l", curr.linkTarget, -1)
|
||||
fileInfo = strings.Replace(fileInfo, "%L", linkTargetArrow, -1)
|
||||
ui.echo(fileInfo)
|
||||
}
|
||||
|
||||
func (ui *ui) drawPromptLine(nav *nav) {
|
||||
|
||||
Reference in new issue
Block a user