fix(syncthing): make directory flags global for all commands (#10028)

The home/config/data flags and end vars apply equally to all subcommands
This commit is contained in:
Jakob Borg
2025-04-03 08:58:46 +02:00
committed by GitHub
parent 82a0dd8eaa
commit b88aea34b6
6 changed files with 88 additions and 133 deletions
-8
View File
@@ -14,13 +14,10 @@ import (
"github.com/alecthomas/kong"
"github.com/kballard/go-shellquote"
"github.com/syncthing/syncthing/cmd/syncthing/cmdutil"
"github.com/syncthing/syncthing/lib/config"
)
type CLI struct {
cmdutil.DirOptions
GUIAddress string `name:"gui-address" env:"STGUIADDRESS"`
GUIAPIKey string `name:"gui-apikey" env:"STGUIAPIKEY"`
@@ -37,11 +34,6 @@ type Context struct {
}
func (cli CLI) AfterApply(kongCtx *kong.Context) error {
err := cmdutil.SetConfigDataLocationsFromFlags(cli.HomeDir, cli.ConfDir, cli.DataDir)
if err != nil {
return fmt.Errorf("command line options: %w", err)
}
clientFactory := &apiClientFactory{
cfg: config.GUIConfiguration{
RawAddress: cli.GUIAddress,