mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 13:55:50 +00:00
20 lines
592 B
TypeScript
20 lines
592 B
TypeScript
import React from 'react'
|
|
import { pathToFileURL } from 'url'
|
|
import { Link } from '@anthropic/ink'
|
|
|
|
type Props = {
|
|
/** The absolute file path */
|
|
filePath: string
|
|
/** Optional display text (defaults to filePath) */
|
|
children?: React.ReactNode
|
|
}
|
|
|
|
/**
|
|
* Renders a file path as an OSC 8 hyperlink.
|
|
* This helps terminals like iTerm correctly identify file paths
|
|
* even when they appear inside parentheses or other text.
|
|
*/
|
|
export function FilePathLink({ filePath, children }: Props): React.ReactNode {
|
|
return <Link url={pathToFileURL(filePath).href}>{children ?? filePath}</Link>
|
|
}
|