diff --git a/apps/docs/components/reference/CLICommandSection.tsx b/apps/docs/components/reference/CLICommandSection.tsx index d20c1db8086..f25d32e74cf 100644 --- a/apps/docs/components/reference/CLICommandSection.tsx +++ b/apps/docs/components/reference/CLICommandSection.tsx @@ -14,6 +14,8 @@ export type Flag = { default_value: string accepted_values: AcceptedValue[] required?: boolean + /** Whether subcommands inherit this flag. */ + inherit?: boolean } export type AcceptedValue = { @@ -46,6 +48,14 @@ export type Command = { const CliCommandSection = (props) => { const command = spec.commands.find((x: any) => x.id === props.funcData.id) + const parentCommand = spec.commands.find( + (x: any) => x.subcommands && x.subcommands.find((y: any) => y === props.funcData.id) + ) + + const commandFlags = [ + ...(parentCommand?.flags?.filter((x: any) => x.inherit) || []), + ...command.flags, + ] return ( { )} - {command.subcommands.length > 0 && ( + {command.subcommands?.length > 0 && (

Available Commands

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

Flags