diff --git a/go.mod b/go.mod index d878853..9ad0032 100644 --- a/go.mod +++ b/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 diff --git a/go.sum b/go.sum index 6ab7ee4..47061f2 100644 --- a/go.sum +++ b/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= diff --git a/main.go b/main.go index 3d8d7ac..5e8a3fa 100644 --- a/main.go +++ b/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") ) // 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()