import ReactMarkdown from 'react-markdown' import { IconChevronRight, Tabs } from '~/../../packages/ui' // @ts-expect-error import spec from '~/../../spec/cli_v1_commands.yaml' assert { type: 'yml' } import CodeBlock from '~/components/CodeBlock/CodeBlock' import Options from '~/components/Options' import Param from '~/components/Params' import RefSubLayout from '~/layouts/ref/RefSubLayout' import RefDetailCollapse from './RefDetailCollapse' export type Flag = { id: string name: string description: string default_value: string accepted_values: AcceptedValue[] required?: boolean } export type AcceptedValue = { id: string name: string type: 'string' | 'boolean' | 'object' description?: string } export type Example = { id: string name: string code: string response: string description?: string } export type Command = { id: string title: string description: string flags?: Flag[] summary: string tags?: string[] links?: string[] subcommands?: string[] usage?: string examples?: Example[] } const CliCommandSection = (props) => { const command = spec.commands.find((x: any) => x.id === props.funcData.id) return (
{command.description ? (
{command.description}
) : (

{command.summary}

)}
{command.subcommands.length > 0 && (

Available Commands

)} {command.flags.length > 0 && ( <>

Flags

    {command.flags.map((flag: Flag) => ( <>
  • {flag?.accepted_values && ( {flag?.accepted_values.map((value) => { return })} )}
  • ))}
)}
{(command.examples || command.usage) && (
{command.examples ? ( command.examples.map((example) => { const exampleId = `${command.id}-${example.id}` return ( {example.code} {example.response} {example.description && (
{example.description}
)}
) }) ) : ( // TODO: remove this block once all commands have examples {command.usage} )}
)}
) } export default CliCommandSection