MCPcopy Create free account
hub / github.com/compozy/agh / resolveSupportBundleOutputPath

Function resolveSupportBundleOutputPath

internal/cli/support.go:235–265  ·  view source on GitHub ↗
(
	deps commandDeps,
	rawPath string,
	operation SupportBundleOperationRecord,
)

Source from the content-addressed store, hash-verified

233}
234
235func resolveSupportBundleOutputPath(
236 deps commandDeps,
237 rawPath string,
238 operation SupportBundleOperationRecord,
239) (string, error) {
240 homePaths, err := deps.resolveHome()
241 if err != nil {
242 return "", err
243 }
244 fileName := strings.TrimSpace(operation.FileName)
245 if fileName == "" {
246 fileName = fmt.Sprintf("agh-support-bundle-%s.tar.gz", time.Now().UTC().Format("20060102T150405Z"))
247 }
248
249 trimmed := strings.TrimSpace(rawPath)
250 if trimmed == "" {
251 return filepath.Join(homePaths.HomeDir, supportBundlesDirName, fileName), nil
252 }
253 resolved, err := filepath.Abs(trimmed)
254 if err != nil {
255 return "", fmt.Errorf("cli: resolve support bundle output path: %w", err)
256 }
257 info, err := os.Stat(resolved)
258 if err == nil && info.IsDir() {
259 return filepath.Join(resolved, fileName), nil
260 }
261 if err != nil && !errors.Is(err, os.ErrNotExist) {
262 return "", fmt.Errorf("cli: inspect support bundle output path: %w", err)
263 }
264 return resolved, nil
265}
266
267func downloadSupportBundle(
268 ctx context.Context,

Callers 1

runSupportBundleCommandFunction · 0.85

Calls 2

NowMethod · 0.45
IsMethod · 0.45

Tested by

no test coverage detected