refactoring, adding cli to edit config

This commit is contained in:
2025-08-26 21:59:50 +02:00
parent e36b15e271
commit 2c109b945e
14 changed files with 503 additions and 20 deletions

View File

@@ -0,0 +1,39 @@
package version
import (
"context"
"downloadhub/pkg/constants"
"flag"
"fmt"
"runtime"
"github.com/google/subcommands"
)
type (
VersionCmd struct {
}
)
func (*VersionCmd) Name() string { return "version" }
func (*VersionCmd) Synopsis() string { return "show version and system information" }
func (*VersionCmd) Usage() string {
return `Usage: ./cli version
Print the version of the software
Options:
`
}
func (p *VersionCmd) SetFlags(f *flag.FlagSet) {
}
func (p *VersionCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {
fmt.Println("Client: downloadhub cli")
fmt.Println(" Version: " + constants.Version)
fmt.Println(" Go version: " + runtime.Version())
fmt.Println(" OS/Arch: " + runtime.GOOS + "/" + runtime.GOARCH)
return subcommands.ExitSuccess
}