terminal-print
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTerminal Print
终端打印
Print terminal output from iTerm2 to your HP network printer with a single command.
只需一条命令,即可将iTerm2中的终端输出打印到你的HP网络打印机。
When to Use This Skill
适用场景
Use this skill when:
- Printing terminal output to a network printer
- Creating PDF copies of command-line session output
- Archiving terminal logs in print-friendly format
- Sharing terminal output in meetings or documentation
在以下场景使用本技能:
- 将终端输出打印到网络打印机
- 生成命令行会话输出的PDF副本
- 以适合打印的格式归档终端日志
- 在会议或文档中分享终端输出
Quick Start
快速开始
- Copy terminal output in iTerm2 (Cmd+C)
- Invoke this skill
- Review PDF preview, press Enter to print
- 复制 iTerm2中的终端输出(Cmd+C)
- 调用 本技能
- 预览 PDF,按回车键打印
How It Works
工作原理
Clipboard → Strip ANSI → Markdown code block → pandoc/xelatex → PDF → Preview → Print- ANSI codes stripped: Colors and escape sequences removed for clean B&W output
- Monospace font: DejaVu Sans Mono for proper character alignment
- Landscape orientation: Fits ~120 characters per line
- US Letter paper: Auto-detected from printer settings
剪贴板 → 移除ANSI代码 → Markdown代码块 → pandoc/xelatex → PDF → 预览 → 打印- 移除ANSI代码:去除颜色和转义序列,生成清晰的黑白输出
- 等宽字体:使用DejaVu Sans Mono确保字符对齐正确
- 横向排版:每行可容纳约120个字符
- US Letter纸张:根据打印机设置自动检测
Execution
执行方式
bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/doc-tools}/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh"
PRINT_EOFbash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/doc-tools}/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh"
PRINT_EOFOptions
可选参数
Run with arguments by modifying the execution block:
bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/doc-tools}/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh" --no-preview
PRINT_EOF| Flag | Description |
|---|---|
| Read from file instead of clipboard |
| Skip PDF preview, print directly |
| Generate PDF only, don't send to printer |
| Show help message |
修改执行代码块以添加参数运行:
bash
/usr/bin/env bash << 'PRINT_EOF'
SKILL_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/marketplaces/cc-skills/plugins/doc-tools}/skills/terminal-print"
bash "$SKILL_DIR/assets/print-terminal.sh" --no-preview
PRINT_EOF| 参数 | 说明 |
|---|---|
| 从文件读取内容而非剪贴板 |
| 跳过PDF预览,直接打印 |
| 仅生成PDF,不发送至打印机 |
| 显示帮助信息 |
Examples
示例
Print from clipboard (default)
从剪贴板打印(默认)
bash
undefinedbash
undefinedCopy terminal output in iTerm2, then:
先在iTerm2中复制终端输出,然后执行:
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh"
EOF
undefined/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh"
EOF
undefinedPrint from file
从文件打印
bash
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh" --file ~/session.log
EOFbash
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh" --file ~/session.log
EOFGenerate PDF only (no print)
仅生成PDF(不打印)
bash
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh" --no-print
EOFbash
/usr/bin/env bash << 'EOF'
bash "${CLAUDE_PLUGIN_ROOT}/skills/terminal-print/assets/print-terminal.sh" --no-print
EOFPrerequisites
前置依赖
All dependencies are already available on macOS with MacTeX:
| Tool | Purpose | Status |
|---|---|---|
| Markdown to PDF | Required |
| PDF engine | Required (MacTeX) |
| Clipboard access | Built-in |
| CUPS printing | Built-in |
在安装了MacTeX的macOS系统中,所有依赖均已可用:
| 工具 | 用途 | 状态 |
|---|---|---|
| Markdown转PDF | 必需 |
| PDF引擎 | 必需(需安装MacTeX) |
| 访问剪贴板 | 系统内置 |
| CUPS打印 | 系统内置 |
Output
输出
- PDF location:
/tmp/terminal-output-YYYYMMDD_HHMMSS.pdf - Markdown source:
/tmp/terminal-YYYYMMDD_HHMMSS.md - Cleanup: macOS automatically cleans periodically
/tmp
- PDF位置:
/tmp/terminal-output-YYYYMMDD_HHMMSS.pdf - Markdown源文件:
/tmp/terminal-YYYYMMDD_HHMMSS.md - 清理:macOS会定期自动清理目录
/tmp
Troubleshooting
故障排除
"No text in clipboard"
"剪贴板中无文本"
Copy terminal output first using Cmd+C in iTerm2.
先在iTerm2中使用Cmd+C复制终端输出。
"Missing pandoc" or "Missing xelatex"
"缺少pandoc"或"缺少xelatex"
Install MacTeX:
brew install --cask mactex安装MacTeX:
brew install --cask mactexPrinter not found
未找到打印机
Check printer status:
lpstat -p -dThe default printer is . Edit the script to change.
HP_LaserJet_Pro_MFP_3101_3108检查打印机状态:
lpstat -p -d默认打印机为。可编辑脚本修改默认打印机。
HP_LaserJet_Pro_MFP_3101_3108Related Skills
相关技能
- pandoc-pdf-generation - General Markdown to PDF conversion
- asciinema-converter - Convert terminal recordings
- pandoc-pdf-generation - 通用Markdown转PDF转换
- asciinema-converter - 转换终端录制内容