mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +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.
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import Param from '~/components/Params'
|
|
import RefSubLayout from '~/layouts/ref/RefSubLayout'
|
|
import { getCustomContent } from '~/lib/custom-content/getCustomContent'
|
|
import spec from '~/spec/cli_v1_commands.yaml' with { type: 'yaml' }
|
|
import { isFeatureEnabled } from 'common'
|
|
|
|
import { CliFlagDefault } from './CliFlagDefault'
|
|
|
|
const { cliDisableCustomProfiles } = isFeatureEnabled(['cli:disable_custom_profiles'])
|
|
|
|
const CliGlobalFlagsHandler = () => {
|
|
// Only fetch cliProfile when custom profiles are enabled
|
|
const cliProfile = !cliDisableCustomProfiles
|
|
? getCustomContent(['cli:profile'] as any).cliProfile
|
|
: undefined
|
|
|
|
// Transform the flags based on feature flags
|
|
const processedFlags = spec.flags.map((flag: any) => {
|
|
if (flag.id === 'profile' && !cliDisableCustomProfiles) {
|
|
return {
|
|
...flag,
|
|
name: `--profile ${cliProfile}`,
|
|
description: `use ${cliProfile} profile for connecting to Supabase API`,
|
|
}
|
|
}
|
|
return flag
|
|
})
|
|
|
|
return (
|
|
<RefSubLayout.EducationRow className="not-prose">
|
|
<RefSubLayout.Details>
|
|
<h3 className="text-lg text-foreground mb-3">Flags</h3>
|
|
<ul>
|
|
{processedFlags.map((flag) => {
|
|
return (
|
|
<Param
|
|
{...flag}
|
|
key={flag.id}
|
|
id={`${spec.id}-${flag.id}`}
|
|
isOptional={flag.required === undefined ? true : !flag.required}
|
|
>
|
|
<CliFlagDefault flag={flag} />
|
|
</Param>
|
|
)
|
|
})}
|
|
</ul>
|
|
</RefSubLayout.Details>
|
|
|
|
<RefSubLayout.Examples></RefSubLayout.Examples>
|
|
</RefSubLayout.EducationRow>
|
|
)
|
|
}
|
|
|
|
export default CliGlobalFlagsHandler
|