sort some functions
exported on top
This commit is contained in:
parent
c80cf605a8
commit
eafd8cd33d
|
@ -43,6 +43,10 @@ func UnExpand(dir, workdir string) (outdir string) {
|
|||
return
|
||||
}
|
||||
|
||||
func UnEscape(input string) string {
|
||||
return strings.ReplaceAll(input, "%20", " ")
|
||||
}
|
||||
|
||||
func cleanDir(dir, pwd string) (out string) {
|
||||
if strings.HasPrefix(dir, ".") {
|
||||
out = filepath.Clean(dir)
|
||||
|
@ -53,7 +57,3 @@ func cleanDir(dir, pwd string) (out string) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func UnEscape(input string) string {
|
||||
return strings.ReplaceAll(input, "%20", " ")
|
||||
}
|
||||
|
|
|
@ -325,22 +325,6 @@ func (m model) selectedFiles() (outfile files.Files) {
|
|||
return false
|
||||
} */
|
||||
|
||||
func newRow(file files.File, workdir string) table.Row {
|
||||
var t, b string
|
||||
t = humanize.Time(file.Date())
|
||||
if file.IsDir() {
|
||||
b = strings.Repeat("─", 3)
|
||||
} else {
|
||||
b = humanize.Bytes(uint64(file.Filesize()))
|
||||
}
|
||||
return table.Row{
|
||||
dirs.UnEscape(file.Name()),
|
||||
dirs.UnExpand(filepath.Dir(file.Path()), workdir),
|
||||
t,
|
||||
b,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *model) freshRows(preselected bool) (rows []table.Row) {
|
||||
for _, f := range m.files {
|
||||
r := newRow(f, m.workdir)
|
||||
|
@ -513,6 +497,22 @@ func Select(fs files.Files, width, height int, readonly, preselected, once bool,
|
|||
return m.selectedFiles(), m.mode, nil
|
||||
}
|
||||
|
||||
func newRow(file files.File, workdir string) table.Row {
|
||||
var t, b string
|
||||
t = humanize.Time(file.Date())
|
||||
if file.IsDir() {
|
||||
b = strings.Repeat("─", 3)
|
||||
} else {
|
||||
b = humanize.Bytes(uint64(file.Filesize()))
|
||||
}
|
||||
return table.Row{
|
||||
dirs.UnEscape(file.Name()),
|
||||
dirs.UnExpand(filepath.Dir(file.Path()), workdir),
|
||||
t,
|
||||
b,
|
||||
}
|
||||
}
|
||||
|
||||
func getCheck(selected bool) (ourcheck string) {
|
||||
if selected {
|
||||
ourcheck = check
|
||||
|
|
Loading…
Reference in a new issue