]> Sergey Matveev's repositories - bass.git/commitdiff
detpax -version/-warranty
authorSergey Matveev <stargrave@stargrave.org>
Wed, 25 Mar 2026 10:06:28 +0000 (13:06 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 25 Mar 2026 10:06:28 +0000 (13:06 +0300)
build/contrib/detpax/main.go

index 833e6183ee91e0f7f5d8e29dccd108c71524c85636d09c7ecfe0475128340178..11b0015737cf98e5292c0802e239fb5e06fe0f8eea6ae68c880929d71fabf0e4 100644 (file)
@@ -23,6 +23,7 @@ import (
        "io/fs"
        "log"
        "os"
+       "runtime"
        "sort"
        "strings"
        "syscall"
@@ -30,6 +31,7 @@ import (
 )
 
 const (
+       Version       = "0.1.0"
        SkelpkgPrefix = "skelpkg"
        DefBufSize    = 1 << 20
        OrderForLinks = 1<<31 - 1
@@ -113,6 +115,8 @@ func walk(
 }
 
 func main() {
+       version := flag.Bool("version", false, "Print version")
+       warranty := flag.Bool("warranty", false, "Print warranty information")
        var precsOrig []string
        flag.Func("prec", "Add directory with higher precedence",
                func(s string) error {
@@ -132,6 +136,26 @@ will put dir/foo/bar first, dir/foo second, others next.`)
                flag.PrintDefaults()
        }
        flag.Parse()
+       if *warranty {
+               fmt.Println(`Copyright (C) 2020-2026 Sergey Matveev
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.`)
+               return
+       }
+       if *version {
+               fmt.Println("detpax", Version, "built with", runtime.Version())
+               return
+       }
        var fd *os.File
        buf := make([]byte, DefBufSize)
        bw := bufio.NewWriterSize(os.Stdout, DefBufSize)