mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
Show default values from the CLI spec on global and command flag rows. For example, readers can see which format `--output-format` uses when omitted. Skip empty defaults and omit `Default: false` for opt-in switches such as `--debug`. Only render a parameter type when one is supplied. This removes the contradictory `no type` label beside CLI flags such as `--network-id <string>` while preserving type labels in the API reference and self-hosting guides. This changes the renderer only. The generated CLI spec is published separately.
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import ReactMarkdown from 'react-markdown'
|
|
import { Badge } from 'ui'
|
|
|
|
type IParamProps = any
|
|
|
|
/**
|
|
* isPrimitive: Indicates whether the value is a basic type such as string or number. It does not refer to an object param.
|
|
* */
|
|
const Param = ({ name, isOptional, type, description, children, isPrimitive }: IParamProps) => {
|
|
return (
|
|
<div className="border-t border-b py-5 flex flex-col gap-3 debugger">
|
|
<div className="flex gap-3 items-center flex-wrap">
|
|
{!isPrimitive && (
|
|
<span className="text-sm text-foreground font-mono font-medium">{name ?? 'no-name'}</span>
|
|
)}
|
|
{isOptional ? (
|
|
<Badge variant="default">Optional</Badge>
|
|
) : (
|
|
<Badge variant="warning">Required</Badge>
|
|
)}
|
|
{type && <span className="text-foreground-muted text-xs">{type}</span>}
|
|
</div>
|
|
{description && (
|
|
<div className="text-sm text-foreground-lighter m-0">
|
|
<ReactMarkdown>{description}</ReactMarkdown>
|
|
</div>
|
|
)}
|
|
{children}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Param
|