Skip to main content
Glama
concatenate_diagnostics.py1.22 kB
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under both the MIT license found in the # LICENSE-MIT file in the root directory of this source tree and the Apache # License, Version 2.0 found in the LICENSE-APACHE file in the root directory # of this source tree. """ Usage: concatenate_diagnostics.py --out path/to/output.txt [path/to/input.txt...] """ import argparse from pathlib import Path from typing import List, NamedTuple class Args(NamedTuple): out: Path subtarget_diagnostics: List[Path] def main(): parser = argparse.ArgumentParser() parser.add_argument("--out", type=Path, required=True) parser.add_argument("subtarget_diagnostics", nargs="*", type=Path) args = Args(**vars(parser.parse_args())) needs_blank_line = False with open(args.out, "wb") as out: for f in args.subtarget_diagnostics: with open(f, "rb") as f: content = f.read() if len(content) == 0: continue if needs_blank_line: out.write(b"\n") out.write(content) needs_blank_line = True if __name__ == "__main__": main()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server