updates...

Former-commit-id: 2d19655aac80ec7033829b0b3d708bf86986252c [formerly b8bb006bd1a5492960c1d4793e15e80775ddc5fd] [formerly 4641277c14953bdb2ddab89ba866cf63f3dac0f9 [formerly 95b91a64a3c648e1414c7feb4b597bf0da195664]]
Former-commit-id: 5a6e07758bbe67fd202effa5b2975c65227eaebd [formerly 9a161548d270750b8da949189ad6f3b641779bfc]
Former-commit-id: 84e0bbcbbead53c5e91987574d5c854a9792515f
This commit is contained in:
Henrique Dias
2017-06-28 11:45:41 +01:00
parent 826d491ff1
commit 0a65393527
1893 changed files with 492634 additions and 10336 deletions

19
file.go
View File

@@ -20,8 +20,6 @@ import (
"sort"
"strings"
"time"
humanize "github.com/dustin/go-humanize"
)
var (
@@ -52,6 +50,8 @@ type fileInfo struct {
VirtualPath string
// Indicates the file content type: video, text, image, music or blob.
Type string
// Stores the content of a text file.
Content string
}
// A listing is the context used to fill out a template.
@@ -73,10 +73,6 @@ type listing struct {
// If ≠0 then Items have been limited to that many elements.
ItemsLimitedTo int
Display string
// Indicates if we're showing a preview in this Listing
Preview bool
// File to preview if Preview is true
PreviewItem *fileInfo
}
// getInfo gets the file information and, in case of error, returns the
@@ -272,17 +268,6 @@ func (i fileInfo) StringifyContent() string {
return string(i.content)
}
// HumanSize returns the size of the file as a human-readable string
// in IEC format (i.e. power of 2 or base 1024).
func (i fileInfo) HumanSize() string {
return humanize.IBytes(uint64(i.Size))
}
// HumanModTime returns the modified time of the file as a human-readable string.
func (i fileInfo) HumanModTime(format string) string {
return i.ModTime.Format(format)
}
// CanBeEdited checks if the extension of a file is supported by the editor
func (i fileInfo) CanBeEdited() bool {
return i.Type == "text"