mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-20 01:26:14 +00:00
Answers #591's open question 2: CLI-only users get no update notice from soundtouch-service's periodic background check. Both binaries gain a soundtouch-cli/soundtouch-backup update-check command that does a single, on-demand GitHub Releases check via the existing pkg/service/updatecheck package. Running the command is itself the opt-in, so unlike the service there's no config flag or persisted state. pkg/service/updatecheck.Checker was already designed decoupled from handlers.Server/main.go specifically so other binaries could import it directly; this is that follow-through.
43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
// Package main implements the soundtouch-backup tool for backing up Bose SoundTouch
|
|
// cloud account data and local speaker filesystem files.
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"runtime/debug"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var version = "dev"
|
|
|
|
func init() {
|
|
if info, ok := debug.ReadBuildInfo(); ok {
|
|
// Only fall back to build info when the version was not injected via
|
|
// -ldflags (i.e. still the "dev" default, e.g. `go install …@vX.Y.Z`).
|
|
// This keeps an explicitly stamped release version from being clobbered
|
|
// by a VCS pseudo-version (e.g. v0.0.0-… from a shallow checkout).
|
|
if version == "dev" && info.Main.Version != "" && info.Main.Version != "(devel)" {
|
|
version = info.Main.Version
|
|
}
|
|
}
|
|
}
|
|
|
|
func main() {
|
|
app := &cli.App{
|
|
Name: "soundtouch-backup",
|
|
Usage: "Back up Bose SoundTouch account and speaker data",
|
|
Version: version,
|
|
Commands: []*cli.Command{
|
|
allCommand(),
|
|
cloudCommand(),
|
|
localCommand(),
|
|
updateCheckCommand(),
|
|
},
|
|
}
|
|
if err := app.Run(os.Args); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|