diff --git a/cmd/files.go b/cmd/files.go index 8be3d80..86262f9 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -505,6 +505,24 @@ func fileList(paths []string, filters *Filters, sort string, index *Index) ([]st return fileList, false } +func cleanFilename(filename string) string { + return filename[:len(filename)-(len(filepath.Ext(filename))+3)] +} + +func prepareDirectory(directory []string) []string { + _, first := filepath.Split(directory[0]) + first = cleanFilename(first) + + _, last := filepath.Split(directory[len(directory)-1]) + last = cleanFilename(last) + + if first == last { + return append([]string{}, directory[0]) + } else { + return directory + } +} + func prepareDirectories(files *Files, sort string) []string { i, l := 0, 0 @@ -520,8 +538,14 @@ func prepareDirectories(files *Files, sort string) []string { directories := make([]string, l) - for i := 0; i < len(keys); i++ { - copy(directories, files.list[keys[i]]) + if sort == "asc" || sort == "desc" { + for i := 0; i < len(keys); i++ { + copy(directories, prepareDirectory(files.list[keys[i]])) + } + } else { + for i := 0; i < len(keys); i++ { + copy(directories, files.list[keys[i]]) + } } files.mutex.RUnlock() diff --git a/cmd/version.go b/cmd/version.go index f22ed8d..e21f671 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.38.0" +var Version = "0.38.1" func init() { rootCmd.AddCommand(versionCmd) diff --git a/stats.file b/stats.file new file mode 100644 index 0000000..232038b Binary files /dev/null and b/stats.file differ