Files
kopia/internal/server/api_cli.go
Julio Lopez 8098f49c90 chore(ci): remove exclusion for unused ctx parameters (#4530)
Remove unused-parameter exclusion for `ctx` in revive linter.

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-26 23:11:36 -07:00

29 lines
521 B
Go

package server
import (
"context"
"os"
"strings"
"github.com/kopia/kopia/internal/serverapi"
)
func handleCLIInfo(_ context.Context, rc requestContext) (interface{}, *apiError) {
executable, err := os.Executable()
if err != nil {
executable = "kopia"
}
return &serverapi.CLIInfo{
Executable: maybeQuote(executable) + " --config-file=" + maybeQuote(rc.srv.getOptions().ConfigFile) + "",
}, nil
}
func maybeQuote(s string) string {
if !strings.Contains(s, " ") {
return s
}
return "\"" + s + "\""
}