mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,44 +1,39 @@
|
||||
import * as React from 'react'
|
||||
import { DIAMOND_FILLED, DIAMOND_OPEN } from '../../constants/figures.js'
|
||||
import { NO_CONTENT_MESSAGE } from '../../constants/messages.js'
|
||||
import { Box, Text } from '@anthropic/ink'
|
||||
import { extractTag } from '../../utils/messages.js'
|
||||
import { Markdown } from '../Markdown.js'
|
||||
import { MessageResponse } from '../MessageResponse.js'
|
||||
import * as React from 'react';
|
||||
import { DIAMOND_FILLED, DIAMOND_OPEN } from '../../constants/figures.js';
|
||||
import { NO_CONTENT_MESSAGE } from '../../constants/messages.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { extractTag } from '../../utils/messages.js';
|
||||
import { Markdown } from '../Markdown.js';
|
||||
import { MessageResponse } from '../MessageResponse.js';
|
||||
|
||||
type Props = {
|
||||
content: string
|
||||
}
|
||||
content: string;
|
||||
};
|
||||
|
||||
export function UserLocalCommandOutputMessage({
|
||||
content,
|
||||
}: Props): React.ReactNode {
|
||||
const stdout = extractTag(content, 'local-command-stdout')
|
||||
const stderr = extractTag(content, 'local-command-stderr')
|
||||
export function UserLocalCommandOutputMessage({ content }: Props): React.ReactNode {
|
||||
const stdout = extractTag(content, 'local-command-stdout');
|
||||
const stderr = extractTag(content, 'local-command-stderr');
|
||||
if (!stdout && !stderr) {
|
||||
return (
|
||||
<MessageResponse>
|
||||
<Text dimColor>{NO_CONTENT_MESSAGE}</Text>
|
||||
</MessageResponse>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const lines: React.ReactNode[] = []
|
||||
const lines: React.ReactNode[] = [];
|
||||
if (stdout?.trim()) {
|
||||
lines.push(<IndentedContent key="stdout">{stdout.trim()}</IndentedContent>)
|
||||
lines.push(<IndentedContent key="stdout">{stdout.trim()}</IndentedContent>);
|
||||
}
|
||||
if (stderr?.trim()) {
|
||||
lines.push(<IndentedContent key="stderr">{stderr.trim()}</IndentedContent>)
|
||||
lines.push(<IndentedContent key="stderr">{stderr.trim()}</IndentedContent>);
|
||||
}
|
||||
return lines
|
||||
return lines;
|
||||
}
|
||||
|
||||
function IndentedContent({ children }: { children: string }): React.ReactNode {
|
||||
if (
|
||||
children.startsWith(`${DIAMOND_OPEN} `) ||
|
||||
children.startsWith(`${DIAMOND_FILLED} `)
|
||||
) {
|
||||
return <CloudLaunchContent>{children}</CloudLaunchContent>
|
||||
if (children.startsWith(`${DIAMOND_OPEN} `) || children.startsWith(`${DIAMOND_FILLED} `)) {
|
||||
return <CloudLaunchContent>{children}</CloudLaunchContent>;
|
||||
}
|
||||
return (
|
||||
<Box flexDirection="row">
|
||||
@@ -47,21 +42,17 @@ function IndentedContent({ children }: { children: string }): React.ReactNode {
|
||||
<Markdown>{children}</Markdown>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function CloudLaunchContent({
|
||||
children,
|
||||
}: {
|
||||
children: string
|
||||
}): React.ReactNode {
|
||||
const diamond = children[0]!
|
||||
const nl = children.indexOf('\n')
|
||||
const header = nl === -1 ? children.slice(2) : children.slice(2, nl)
|
||||
const rest = nl === -1 ? '' : children.slice(nl + 1).trim()
|
||||
const sep = header.indexOf(' · ')
|
||||
const label = sep === -1 ? header : header.slice(0, sep)
|
||||
const suffix = sep === -1 ? '' : header.slice(sep)
|
||||
function CloudLaunchContent({ children }: { children: string }): React.ReactNode {
|
||||
const diamond = children[0]!;
|
||||
const nl = children.indexOf('\n');
|
||||
const header = nl === -1 ? children.slice(2) : children.slice(2, nl);
|
||||
const rest = nl === -1 ? '' : children.slice(nl + 1).trim();
|
||||
const sep = header.indexOf(' · ');
|
||||
const label = sep === -1 ? header : header.slice(0, sep);
|
||||
const suffix = sep === -1 ? '' : header.slice(sep);
|
||||
return (
|
||||
<Box flexDirection="column">
|
||||
<Text>
|
||||
@@ -76,5 +67,5 @@ function CloudLaunchContent({
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user