MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / parseArgs

Function parseArgs

scripts/tmux/tmux-viewer/index.tsx:39–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39function parseArgs(): ParsedArgs {
40 const program = new Command()
41
42 program
43 .name('tmux-viewer')
44 .description('Interactive viewer for tmux session logs')
45 .version('0.0.1')
46 .option('--json', 'Output session data as JSON (for AI consumption)')
47 .option('--list', 'List available sessions')
48 .option('--replay', 'Start in replay mode (auto-playing through captures)')
49 .option('--export-gif [path]', 'Export session as animated GIF (default: <session>.gif)')
50 .option('--frame-delay <ms>', 'Frame delay in ms for GIF export (default: 1500)', parseInt)
51 .option('--font-size <px>', 'Font size in pixels for GIF export (default: 14)', parseInt)
52 .argument('[session]', 'Session name to view')
53 .parse(process.argv)
54
55 const options = program.opts()
56 const args = program.args
57
58 return {
59 session: args[0] ?? null,
60 json: options.json ?? false,
61 list: options.list ?? false,
62 replay: options.replay ?? false,
63 exportGif: options.exportGif ?? false,
64 frameDelay: options.frameDelay,
65 fontSize: options.fontSize,
66 }
67}
68
69async function main(): Promise<void> {
70 const { session, json, list, replay, exportGif, frameDelay, fontSize } = parseArgs()

Callers 1

mainFunction · 0.70

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected