Compare commits
No commits in common. "main" and "v1.0.0" have entirely different histories.
24
.gitignore
vendored
24
.gitignore
vendored
@ -1,2 +1,24 @@
|
|||||||
|
# ---> Go
|
||||||
|
# If you prefer the allow list template instead of the deny list, see community template:
|
||||||
|
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||||
|
#
|
||||||
|
# Binaries for programs and plugins
|
||||||
|
*.exe
|
||||||
|
*.exe~
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Test binary, built with `go test -c`
|
||||||
|
*.test
|
||||||
|
|
||||||
|
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||||
|
*.out
|
||||||
|
|
||||||
|
# Dependency directories (remove the comment below to include it)
|
||||||
|
# vendor/
|
||||||
|
|
||||||
|
# Go workspace file
|
||||||
|
go.work
|
||||||
|
|
||||||
diskspace
|
diskspace
|
||||||
output
|
|
@ -32,7 +32,7 @@ func ls(args []string) {
|
|||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println(entry.StringRecursive(*RecursiveDirDepth))
|
fmt.Println(entry.StringRecursive(1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ func exit() {
|
|||||||
s := bufio.NewScanner(os.Stdin)
|
s := bufio.NewScanner(os.Stdin)
|
||||||
s.Split(bufio.ScanRunes)
|
s.Split(bufio.ScanRunes)
|
||||||
|
|
||||||
fmt.Print(Translate("exit? [%s/%s]: ", "y", "N"))
|
fmt.Print(Translate("exit? [y/N]: "))
|
||||||
if s.Scan() {
|
if s.Scan() {
|
||||||
text := strings.ToLower(s.Text())
|
text := strings.ToLower(s.Text())
|
||||||
if text == "y" || text == "yes" {
|
if text == "y" || text == "yes" {
|
||||||
@ -108,7 +108,7 @@ func exit() {
|
|||||||
s := bufio.NewScanner(os.Stdin)
|
s := bufio.NewScanner(os.Stdin)
|
||||||
s.Split(bufio.ScanRunes)
|
s.Split(bufio.ScanRunes)
|
||||||
|
|
||||||
fmt.Print(Translate("Delete files? [%s/%s/%s]: ", ColorRed.Sprint("y"), "n", "C"))
|
fmt.Print(Translate("Delete files? [y/N/c]: "))
|
||||||
if s.Scan() {
|
if s.Scan() {
|
||||||
text := strings.ToLower(s.Text())
|
text := strings.ToLower(s.Text())
|
||||||
if text == "y" || text == "yes" {
|
if text == "y" || text == "yes" {
|
||||||
|
5
go.mod
5
go.mod
@ -2,10 +2,7 @@ module git.milar.in/milarin/diskspace
|
|||||||
|
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|
||||||
require (
|
require github.com/fatih/color v1.13.0
|
||||||
git.milar.in/milarin/buildinfo v1.0.0
|
|
||||||
github.com/fatih/color v1.13.0
|
|
||||||
)
|
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/mattn/go-colorable v0.1.9 // indirect
|
github.com/mattn/go-colorable v0.1.9 // indirect
|
||||||
|
2
go.sum
2
go.sum
@ -1,5 +1,3 @@
|
|||||||
git.milar.in/milarin/buildinfo v1.0.0 h1:tw98GupUYl/0a/3aPGuezhE4wseycOSsbcLp70hy60U=
|
|
||||||
git.milar.in/milarin/buildinfo v1.0.0/go.mod h1:arI9ZoENOgcZcanv25k9y4dKDUhPp0buJrlVerGruas=
|
|
||||||
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
|
||||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||||
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
|
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
|
||||||
|
13
main.go
13
main.go
@ -12,7 +12,6 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.milar.in/milarin/buildinfo"
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,9 +23,7 @@ var (
|
|||||||
ColorBlue = color.New(color.FgBlue)
|
ColorBlue = color.New(color.FgBlue)
|
||||||
ColorGreen = color.New(color.FgGreen)
|
ColorGreen = color.New(color.FgGreen)
|
||||||
|
|
||||||
IconTheme = flag.String("i", "unicode", "icon theme (currently supported: default, unicode, nerd)")
|
IconTheme = flag.String("i", "unicode", "icon theme (currently supported: default, unicode, nerd)")
|
||||||
ShowVersion = flag.Bool("v", false, "show version and exit")
|
|
||||||
RecursiveDirDepth = flag.Int("d", 1, "depth for recursively printing files of directories")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIXME sometimes sorting not applied after removing items
|
// FIXME sometimes sorting not applied after removing items
|
||||||
@ -37,12 +34,6 @@ var (
|
|||||||
// TODO autocomplete on TAB (see arrow up issue: raw necessary?)
|
// TODO autocomplete on TAB (see arrow up issue: raw necessary?)
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *ShowVersion {
|
|
||||||
buildinfo.Print(buildinfo.Options{})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
rootPath := flag.Arg(0)
|
rootPath := flag.Arg(0)
|
||||||
|
|
||||||
mounts, err := Mounts()
|
mounts, err := Mounts()
|
||||||
@ -83,7 +74,7 @@ func main() {
|
|||||||
showCurrentDir := true
|
showCurrentDir := true
|
||||||
for {
|
for {
|
||||||
if showCurrentDir {
|
if showCurrentDir {
|
||||||
fmt.Println(Current.StringRecursive(*RecursiveDirDepth))
|
fmt.Println(Current.StringRecursive(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Print("> ")
|
fmt.Print("> ")
|
||||||
|
@ -23,6 +23,7 @@ var Languages = map[string]map[string]string{
|
|||||||
"Total size: %s": "Gesamtgröße: %s",
|
"Total size: %s": "Gesamtgröße: %s",
|
||||||
"'%s' could not be found": "'%s' konnte nicht gefunden werden",
|
"'%s' could not be found": "'%s' konnte nicht gefunden werden",
|
||||||
"Could not delete '%s': %s": "'%s' konnte nicht gelöscht werden: %s",
|
"Could not delete '%s': %s": "'%s' konnte nicht gelöscht werden: %s",
|
||||||
|
"Delete files? [y/N/c]: ": "Dateien löschen? [y/N/c]: ",
|
||||||
"ambiguous path: %s": "Nicht eindeutiger Pfad: %s",
|
"ambiguous path: %s": "Nicht eindeutiger Pfad: %s",
|
||||||
"possible paths:\n%s": "Mögliche Pfade:\n%s",
|
"possible paths:\n%s": "Mögliche Pfade:\n%s",
|
||||||
"Commands:": "Befehle:",
|
"Commands:": "Befehle:",
|
||||||
@ -32,8 +33,7 @@ var Languages = map[string]map[string]string{
|
|||||||
"urm: unmark files for removal": "urm: Entmarkiere Dateien zur Löschung",
|
"urm: unmark files for removal": "urm: Entmarkiere Dateien zur Löschung",
|
||||||
"exit: delete marked files and exit": "exit: Lösche markierte Dateien und beende Programm",
|
"exit: delete marked files and exit": "exit: Lösche markierte Dateien und beende Programm",
|
||||||
"Use command 'exit' for exiting properly": "Nutze den Befehl 'exit', um das Programm ordnungsgemäß zu beenden",
|
"Use command 'exit' for exiting properly": "Nutze den Befehl 'exit', um das Programm ordnungsgemäß zu beenden",
|
||||||
"Delete files? [%s/%s/%s]: ": "Dateien löschen? [%s/%s/%s]: ",
|
"exit? [y/N]: ": "Beenden? [y/N]: ",
|
||||||
"exit? [%s/%s]: ": "Beenden? [%s/%s]: ",
|
|
||||||
},
|
},
|
||||||
"ja": {
|
"ja": {
|
||||||
"fileCountFormat": "%d個",
|
"fileCountFormat": "%d個",
|
||||||
@ -47,6 +47,7 @@ var Languages = map[string]map[string]string{
|
|||||||
"Total size: %s": "全額: %s",
|
"Total size: %s": "全額: %s",
|
||||||
"'%s' could not be found": "「%s」が見つかりませんでした",
|
"'%s' could not be found": "「%s」が見つかりませんでした",
|
||||||
"Could not delete '%s': %s": "「%s」が削除できませんでした: %s",
|
"Could not delete '%s': %s": "「%s」が削除できませんでした: %s",
|
||||||
|
"Delete files? [y/N/c]: ": "削除してほしいですか? [y/N/c]: ",
|
||||||
"ambiguous path: %s": "あいまいなパス: %s",
|
"ambiguous path: %s": "あいまいなパス: %s",
|
||||||
"possible paths:\n%s": "可能なパス:\n%s",
|
"possible paths:\n%s": "可能なパス:\n%s",
|
||||||
"Commands:": "コマンド:",
|
"Commands:": "コマンド:",
|
||||||
@ -56,8 +57,7 @@ var Languages = map[string]map[string]string{
|
|||||||
"urm: unmark files for removal": "urm: ファイルに削除のマークを除きます",
|
"urm: unmark files for removal": "urm: ファイルに削除のマークを除きます",
|
||||||
"exit: delete marked files and exit": "exit: 削除のマークされたファイルを削除して終了",
|
"exit: delete marked files and exit": "exit: 削除のマークされたファイルを削除して終了",
|
||||||
"Use command 'exit' for exiting properly": "「exit」コマンドを使って終了します",
|
"Use command 'exit' for exiting properly": "「exit」コマンドを使って終了します",
|
||||||
"Delete files? [%s/%s/%s]: ": "削除してほしいですか? [%s/%s/%s]: ",
|
"exit? [y/N]: ": "終了してほしいですか? [y/N]: ",
|
||||||
"exit? [%s/%s]: ": "終了してほしいですか? [%s/%s]: ",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user