package app import ( "fmt" "os/exec" ) // scpArgs builds the scp command line. Files are uploaded in the given order; // callers pass the playlist LAST so stream links never 404 before the files. func scpArgs(files []string, target, keyPath string) []string { args := []string{"-o", "StrictHostKeyChecking=accept-new", "-q"} if keyPath != "" { args = append(args, "-i", keyPath) } args = append(args, files...) args = append(args, target) return args } // Ship uploads files to target (user@host:/path/) via scp. func Ship(files []string, target, keyPath string) error { if len(files) == 0 { return nil } if target == "" { return fmt.Errorf("ship target not configured") } out, err := exec.Command("scp", scpArgs(files, target, keyPath)...).CombinedOutput() if err != nil { return fmt.Errorf("scp to %s: %w: %s", target, err, out) } return nil }