Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
37ee30ec03 | |||
|
c4870bfe0d | ||
|
90265e7080 |
24
.gitignore
vendored
24
.gitignore
vendored
@ -1,24 +1,2 @@
|
||||
# ---> 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
|
||||
output
|
@ -32,7 +32,7 @@ func ls(args []string) {
|
||||
|
||||
for _, entry := range entries {
|
||||
fmt.Println()
|
||||
fmt.Println(entry.StringRecursive(1))
|
||||
fmt.Println(entry.StringRecursive(*RecursiveDirDepth))
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ func exit() {
|
||||
s := bufio.NewScanner(os.Stdin)
|
||||
s.Split(bufio.ScanRunes)
|
||||
|
||||
fmt.Print(Translate("exit? [y/N]: "))
|
||||
fmt.Print(Translate("exit? [%s/%s]: ", "y", "N"))
|
||||
if s.Scan() {
|
||||
text := strings.ToLower(s.Text())
|
||||
if text == "y" || text == "yes" {
|
||||
@ -108,7 +108,7 @@ func exit() {
|
||||
s := bufio.NewScanner(os.Stdin)
|
||||
s.Split(bufio.ScanRunes)
|
||||
|
||||
fmt.Print(Translate("Delete files? [y/N/c]: "))
|
||||
fmt.Print(Translate("Delete files? [%s/%s/%s]: ", ColorRed.Sprint("y"), "n", "C"))
|
||||
if s.Scan() {
|
||||
text := strings.ToLower(s.Text())
|
||||
if text == "y" || text == "yes" {
|
||||
|
5
go.mod
5
go.mod
@ -2,7 +2,10 @@ module git.milar.in/milarin/diskspace
|
||||
|
||||
go 1.18
|
||||
|
||||
require github.com/fatih/color v1.13.0
|
||||
require (
|
||||
git.milar.in/milarin/buildinfo v1.0.0
|
||||
github.com/fatih/color v1.13.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/mattn/go-colorable v0.1.9 // indirect
|
||||
|
2
go.sum
2
go.sum
@ -1,3 +1,5 @@
|
||||
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/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=
|
||||
|
11
main.go
11
main.go
@ -12,6 +12,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"git.milar.in/milarin/buildinfo"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
@ -24,6 +25,8 @@ var (
|
||||
ColorGreen = color.New(color.FgGreen)
|
||||
|
||||
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
|
||||
@ -34,6 +37,12 @@ var (
|
||||
// TODO autocomplete on TAB (see arrow up issue: raw necessary?)
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if *ShowVersion {
|
||||
buildinfo.Print(buildinfo.Options{})
|
||||
return
|
||||
}
|
||||
|
||||
rootPath := flag.Arg(0)
|
||||
|
||||
mounts, err := Mounts()
|
||||
@ -74,7 +83,7 @@ func main() {
|
||||
showCurrentDir := true
|
||||
for {
|
||||
if showCurrentDir {
|
||||
fmt.Println(Current.StringRecursive(1))
|
||||
fmt.Println(Current.StringRecursive(*RecursiveDirDepth))
|
||||
}
|
||||
|
||||
fmt.Print("> ")
|
||||
|
@ -23,7 +23,6 @@ var Languages = map[string]map[string]string{
|
||||
"Total size: %s": "Gesamtgröße: %s",
|
||||
"'%s' could not be found": "'%s' konnte nicht gefunden werden",
|
||||
"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",
|
||||
"possible paths:\n%s": "Mögliche Pfade:\n%s",
|
||||
"Commands:": "Befehle:",
|
||||
@ -33,7 +32,8 @@ var Languages = map[string]map[string]string{
|
||||
"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",
|
||||
"Use command 'exit' for exiting properly": "Nutze den Befehl 'exit', um das Programm ordnungsgemäß zu beenden",
|
||||
"exit? [y/N]: ": "Beenden? [y/N]: ",
|
||||
"Delete files? [%s/%s/%s]: ": "Dateien löschen? [%s/%s/%s]: ",
|
||||
"exit? [%s/%s]: ": "Beenden? [%s/%s]: ",
|
||||
},
|
||||
"ja": {
|
||||
"fileCountFormat": "%d個",
|
||||
@ -47,7 +47,6 @@ var Languages = map[string]map[string]string{
|
||||
"Total size: %s": "全額: %s",
|
||||
"'%s' could not be found": "「%s」が見つかりませんでした",
|
||||
"Could not delete '%s': %s": "「%s」が削除できませんでした: %s",
|
||||
"Delete files? [y/N/c]: ": "削除してほしいですか? [y/N/c]: ",
|
||||
"ambiguous path: %s": "あいまいなパス: %s",
|
||||
"possible paths:\n%s": "可能なパス:\n%s",
|
||||
"Commands:": "コマンド:",
|
||||
@ -57,7 +56,8 @@ var Languages = map[string]map[string]string{
|
||||
"urm: unmark files for removal": "urm: ファイルに削除のマークを除きます",
|
||||
"exit: delete marked files and exit": "exit: 削除のマークされたファイルを削除して終了",
|
||||
"Use command 'exit' for exiting properly": "「exit」コマンドを使って終了します",
|
||||
"exit? [y/N]: ": "終了してほしいですか? [y/N]: ",
|
||||
"Delete files? [%s/%s/%s]: ": "削除してほしいですか? [%s/%s/%s]: ",
|
||||
"exit? [%s/%s]: ": "終了してほしいですか? [%s/%s]: ",
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user