Loading...
Loading...
Compare original and translation side by side
undefinedundefinedundefinedundefined| Flag | Description |
|---|---|
| Non-interactive (headless) mode |
| text, json, stream-json |
| Resume by session ID |
| Continue most recent session |
| Comma-separated allowed tools |
| Comma-separated denied tools |
| Path to MCP server config JSON |
| Enable verbose logging |
| Add to system prompt |
| 标识 | 描述 |
|---|---|
| 非交互式(无头)模式 |
| text, json, stream-json |
| 通过会话ID恢复对话 |
| 恢复最近的会话 |
| 逗号分隔的允许使用的工具 |
| 逗号分隔的禁用工具 |
| MCP服务器配置JSON文件路径 |
| 启用详细日志 |
| 添加系统提示词 |
| Mode | Flag | Effect |
|---|---|---|
| Default | (none) | Prompt for permissions |
| Accept edits | | Auto-accept file changes |
| Bypass | | Skip all prompts |
| 模式 | 标识 | 效果 |
|---|---|---|
| 默认 | (无) | 提示获取权限 |
| 接受编辑 | | 自动接受文件修改 |
| 绕过权限 | | 跳过所有权限提示 |
claude -p "Hello"claude -p "Hello"undefinedundefinedclaude -p "Hello" --output-format json{
"type": "result",
"subtype": "success",
"result": "Hello! How can I help?",
"session_id": "abc123",
"total_cost_usd": 0.001,
"duration_ms": 1234,
"num_turns": 1
}claude -p "Hello" --output-format json{
"type": "result",
"subtype": "success",
"result": "Hello! How can I help?",
"session_id": "abc123",
"total_cost_usd": 0.001,
"duration_ms": 1234,
"num_turns": 1
}claude -p "Hello" --output-format stream-jsonclaude -p "Hello" --output-format stream-jsonundefinedundefinedclaude -p "Analyze the codebase" \
--allowedTools "Read,Grep,Glob" \
--disallowedTools "Write,Edit,Bash"claude -p "Analyze the codebase" \
--allowedTools "Read,Grep,Glob" \
--disallowedTools "Write,Edit,Bash"claude -p "Review this PR diff" \
--permission-mode acceptEdits \
--output-format json \
--append-system-prompt "Focus on security issues"claude -p "Review this PR diff" \
--permission-mode acceptEdits \
--output-format json \
--append-system-prompt "Focus on security issues"session=$(claude -p "Start task" --output-format json | jq -r '.session_id')
claude --resume "$session" "Continue with step 2"
claude --resume "$session" "Finalize and report"session=$(claude -p "Start task" --output-format json | jq -r '.session_id')
claude --resume "$session" "Continue with step 2"
claude --resume "$session" "Finalize and report"result=$(claude -p "Task" --output-format json)
if [[ $(echo "$result" | jq -r '.is_error') == "true" ]]; then
echo "Error: $(echo "$result" | jq -r '.result')" >&2
exit 1
firesult=$(claude -p "Task" --output-format json)
if [[ $(echo "$result" | jq -r '.is_error') == "true" ]]; then
echo "Error: $(echo "$result" | jq -r '.result')" >&2
exit 1
fi./references/cli-options.md./references/output-formats.md./references/integration-patterns.mdclaude-code-hooksclaude-code-debug./references/cli-options.md./references/output-formats.md./references/integration-patterns.mdclaude-code-hooksclaude-code-debug