Compare commits
No commits in common. "51c6ca56acdab1a12108b3a55e3e5306d5ff7814" and "4248994b75a7037450e2ba799f5297251accf9a7" have entirely different histories.
51c6ca56ac
...
4248994b75
13
dir_entry.go
13
dir_entry.go
@ -141,6 +141,13 @@ func (e *DirectoryEntry) SetRemovalMark(mark bool) {
|
|||||||
for _, entry := range e.Entries() {
|
for _, entry := range e.Entries() {
|
||||||
entry.SetRemovalMark(mark)
|
entry.SetRemovalMark(mark)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if e.Parent() != nil {
|
||||||
|
pentries := e.Parent().Entries()
|
||||||
|
sort.Slice(pentries, func(i, j int) bool {
|
||||||
|
return pentries[i].SizeModified() < pentries[j].SizeModified()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *DirectoryEntry) RemovalMark() bool {
|
func (e *DirectoryEntry) RemovalMark() bool {
|
||||||
@ -159,12 +166,6 @@ func (e *DirectoryEntry) modifySize(modifier uint64) {
|
|||||||
*e.modSize += modifier
|
*e.modSize += modifier
|
||||||
if e.parent != nil {
|
if e.parent != nil {
|
||||||
e.parent.modifySize(modifier)
|
e.parent.modifySize(modifier)
|
||||||
|
|
||||||
// recalculate order of parent entries
|
|
||||||
pentries := e.Parent().Entries()
|
|
||||||
sort.Slice(pentries, func(i, j int) bool {
|
|
||||||
return pentries[i].SizeModified() < pentries[j].SizeModified()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -118,12 +117,6 @@ func (e *FileEntry) SetRemovalMark(mark bool) {
|
|||||||
} else {
|
} else {
|
||||||
e.modifySize(*e.size)
|
e.modifySize(*e.size)
|
||||||
}
|
}
|
||||||
|
|
||||||
// recalculate order of parent entries
|
|
||||||
pentries := e.Parent().Entries()
|
|
||||||
sort.Slice(pentries, func(i, j int) bool {
|
|
||||||
return pentries[i].SizeModified() < pentries[j].SizeModified()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *FileEntry) RemovalMark() bool {
|
func (e *FileEntry) RemovalMark() bool {
|
||||||
|
8
go.mod
8
go.mod
@ -1,11 +1,15 @@
|
|||||||
module git.milar.in/milarin/diskspace
|
module git.tordarus.net/Tordarus/diskspace
|
||||||
|
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require github.com/fatih/color v1.13.0
|
require (
|
||||||
|
github.com/fatih/color v1.13.0
|
||||||
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d
|
||||||
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/mattn/go-colorable v0.1.9 // indirect
|
github.com/mattn/go-colorable v0.1.9 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
|
||||||
)
|
)
|
||||||
|
5
go.sum
5
go.sum
@ -5,7 +5,12 @@ github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope
|
|||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
|
||||||
|
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
6
main.go
6
main.go
@ -26,12 +26,6 @@ var (
|
|||||||
IconTheme = flag.String("i", "unicode", "icon theme (currently supported: default, unicode, nerd)")
|
IconTheme = flag.String("i", "unicode", "icon theme (currently supported: default, unicode, nerd)")
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIXME sometimes sorting not applied after removing items
|
|
||||||
// TODO pwd command showing Current entry path and Root entry path in filesystem
|
|
||||||
// TODO arrow up -> last command (`stty -raw` necessary?). even better: rlwrap impl (see tsoding noq)
|
|
||||||
// TODO config file with preferred icon theme or read best icon theme from terminfo somehow
|
|
||||||
// TODO on exit: show deleted files in recursive tree (only deleted files and their parent directories)
|
|
||||||
// TODO autocomplete on TAB (see arrow up issue: raw necessary?)
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
rootPath := flag.Arg(0)
|
rootPath := flag.Arg(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user