Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Formats the CLI usage

Copplef53ed0ef0c1c
diff --git a/apps/reference/_cli/usage.mdx b/apps/reference/_cli/usage.mdx
index 92173fd9a22..d5e0d11e246 100644
--- a/apps/reference/_cli/usage.mdx
+++ b/apps/reference/_cli/usage.mdx
@@ -1,11 +1,13 @@
---
id: usage
title: Usage
+toc_max_heading_level: 3
---
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
-Supabase CLI
+Supabase CLI provides you with tools to develop your application locally, and deploy your application to the Supabase platform.
+
@@ -13,12 +15,12 @@ Supabase CLI
<br /><br />
-## Stop the Supabase local development setup {#supabase-stop}
+### Stop all local Supabase containers {#supabase-stop}
+
-### Usage
```sh
supabase stop [flags]
@@ -26,7 +28,9 @@ supabase stop [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for stop
@@ -38,12 +42,12 @@ supabase stop [flags]
<br /><br />
-## Show status of the Supabase local development setup {#supabase-status}
+### Show status of local Supabase containers {#supabase-status}
+
-### Usage
```sh
supabase status [flags]
@@ -51,7 +55,9 @@ supabase status [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for status
@@ -63,12 +69,12 @@ supabase status [flags]
<br /><br />
-## Start the Supabase local development setup {#supabase-start}
+### Start containers for Supabase local development {#supabase-start}
+
-### Usage
```sh
supabase start [flags]
@@ -76,7 +82,9 @@ supabase start [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for start
@@ -93,23 +101,23 @@ supabase start [flags]
-### Usage
-### Available Commands
+**Available Commands**
-- <a href="#supabase-secrets-list">supabase-secrets-list</a>
-- <a href="#supabase-secrets-set">supabase-secrets-set</a>
+- <a href="#supabase-secrets-list"><code>supabase secrets list</code></a>
-- <a href="#supabase-secrets-unset">supabase-secrets-unset</a>
+- <a href="#supabase-secrets-set"><code>supabase secrets set</code></a>
+- <a href="#supabase-secrets-unset"><code>supabase secrets unset</code></a>
-### Options
+
+**Options**
```sh
-h, --help help for secrets
@@ -121,12 +129,12 @@ supabase start [flags]
<br /><br />
-## Unset a secret(s) from the linked Supabase project {#supabase-secrets-unset}
+### Unset a secret(s) on Supabase {#supabase-secrets-unset}
+Unset a secret(s) from the linked Supabase project.
-### Usage
```sh
supabase secrets unset <NAME> ... [flags]
@@ -134,7 +142,9 @@ supabase secrets unset <NAME> ... [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for unset
@@ -146,12 +156,12 @@ supabase secrets unset <NAME> ... [flags]
<br /><br />
-## Set a secret(s) to the linked Supabase project {#supabase-secrets-set}
+### Set a secret(s) on Supabase {#supabase-secrets-set}
+Set a secret(s) to the linked Supabase project.
-### Usage
```sh
supabase secrets set [flags] <NAME=VALUE> ...
@@ -159,7 +169,9 @@ supabase secrets set [flags] <NAME=VALUE> ...
-### Options
+
+
+**Options**
```sh
--env-file string Read secrets from a .env file.
@@ -172,12 +184,12 @@ supabase secrets set [flags] <NAME=VALUE> ...
<br /><br />
-## List all secrets in the linked project {#supabase-secrets-list}
+### List all secrets on Supabase {#supabase-secrets-list}
+List all secrets in the linked project.
-### Usage
```sh
supabase secrets list [flags]
@@ -185,7 +197,9 @@ supabase secrets list [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for list
@@ -202,21 +216,21 @@ supabase secrets list [flags]
-### Usage
-### Available Commands
+
+**Available Commands**
-- <a href="#supabase-projects-create">supabase-projects-create</a>
+- <a href="#supabase-projects-create"><code>supabase projects create</code></a>
-- <a href="#supabase-projects-list">supabase-projects-list</a>
+- <a href="#supabase-projects-list"><code>supabase projects list</code></a>
-### Options
+**Options**
```sh
-h, --help help for projects
@@ -228,12 +242,12 @@ supabase secrets list [flags]
<br /><br />
-## List all projects {#supabase-projects-list}
+### List all Supabase projects {#supabase-projects-list}
+List all Supabase projects the logged-in user can access.
-### Usage
```sh
supabase projects list [flags]
@@ -241,7 +255,9 @@ supabase projects list [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for list
@@ -253,26 +269,29 @@ supabase projects list [flags]
<br /><br />
-## Create a new project {#supabase-projects-create}
+### Create a project on Supabase {#supabase-projects-create}
+
-### Usage
```sh
-supabase projects create [flags]
+supabase projects create <project name> [flags]
```
-### Options
+
+
+**Options**
```sh
--db-password string Database password of the project.
-h, --help help for create
+ -i, --interactive Enables interactive mode.
--org-id string Organization ID to create the project in.
- --plan string Select a plan that suits your needs. Can be "free" or "pro". (default "free")
+ --plan string Select a plan that suits your needs. (default "free")
--region string Select a region close to you for the best performance.
```
@@ -287,19 +306,19 @@ supabase projects create [flags]
-### Usage
-### Available Commands
+
+**Available Commands**
-- <a href="#supabase-orgs-list">supabase-orgs-list</a>
+- <a href="#supabase-orgs-list"><code>supabase orgs list</code></a>
-### Options
+**Options**
```sh
-h, --help help for orgs
@@ -311,12 +330,12 @@ supabase projects create [flags]
<br /><br />
-## List all organizations the logged-in user belongs {#supabase-orgs-list}
+### List all organizations {#supabase-orgs-list}
+List all organizations the logged-in user belongs.
-### Usage
```sh
supabase orgs list [flags]
@@ -324,7 +343,9 @@ supabase orgs list [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for list
@@ -341,19 +362,21 @@ supabase orgs list [flags]
-### Usage
-### Available Commands
+**Available Commands**
+
+
+- <a href="#supabase-migration-list"><code>supabase migration list</code></a>
-- <a href="#supabase-migration-new">supabase-migration-new</a>
+- <a href="#supabase-migration-new"><code>supabase migration new</code></a>
-### Options
+**Options**
```sh
-h, --help help for migration
@@ -365,12 +388,12 @@ supabase orgs list [flags]
<br /><br />
-## Create an empty migration script {#supabase-migration-new}
+### Create an empty migration script {#supabase-migration-new}
+
-### Usage
```sh
supabase migration new <migration name> [flags]
@@ -378,7 +401,9 @@ supabase migration new <migration name> [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for new
@@ -390,12 +415,40 @@ supabase migration new <migration name> [flags]
<br /><br />
-## Authenticate using an access token {#supabase-login}
+### List local and remote migrations {#supabase-migration-list}
+
+
+
+
+
+
+```sh
+supabase migration list [flags]
+```
+
+
+
+
+
+**Options**
+
+```sh
+ -h, --help help for list
+ -p, --password string Password to your remote Postgres database.
+```
+
+
+
+<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
+
+<br /><br />
+
+### Authenticate using an access token {#supabase-login}
+
-### Usage
```sh
supabase login [flags]
@@ -403,7 +456,9 @@ supabase login [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for login
@@ -415,12 +470,12 @@ supabase login [flags]
<br /><br />
-## Link to a Supabase project {#supabase-link}
+### Link to a Supabase project {#supabase-link}
+
-### Usage
```sh
supabase link [flags]
@@ -428,10 +483,13 @@ supabase link [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for link
+ -p, --password string Password to your remote Postgres database.
--project-ref string Project ref of the Supabase project.
```
@@ -441,12 +499,12 @@ supabase link [flags]
<br /><br />
-## Initialize a project to use Supabase CLI {#supabase-init}
+### Initialize a local project {#supabase-init}
+
-### Usage
```sh
supabase init [flags]
@@ -454,7 +512,9 @@ supabase init [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for init
@@ -471,19 +531,19 @@ supabase init [flags]
-### Usage
-### Available Commands
+
+**Available Commands**
-- <a href="#supabase-gen-types">supabase-gen-types</a>
+- <a href="#supabase-gen-types"><code>supabase gen types</code></a>
-### Options
+**Options**
```sh
-h, --help help for gen
@@ -500,19 +560,19 @@ supabase init [flags]
-### Usage
-### Available Commands
+**Available Commands**
-- <a href="#supabase-gen-types-typescript">supabase-gen-types-typescript</a>
+- <a href="#supabase-gen-types-typescript"><code>supabase gen types typescript</code></a>
-### Options
+
+**Options**
```sh
-h, --help help for types
@@ -524,13 +584,13 @@ supabase init [flags]
<br /><br />
-## Generate types for TypeScript. Must specify either --local or --db-url
- {#supabase-gen-types-typescript}
+### Generate types for TypeScript {#supabase-gen-types-typescript}
+
+Generate types for TypeScript. Must specify either --local or --db-url
-### Usage
```sh
supabase gen types typescript [flags]
@@ -538,7 +598,9 @@ supabase gen types typescript [flags]
-### Options
+
+
+**Options**
```sh
--db-url string Generate types from a database url.
@@ -557,25 +619,25 @@ supabase gen types typescript [flags]
-### Usage
-### Available Commands
+**Available Commands**
-- <a href="#supabase-functions-delete">supabase-functions-delete</a>
-- <a href="#supabase-functions-deploy">supabase-functions-deploy</a>
+- <a href="#supabase-functions-delete"><code>supabase functions delete</code></a>
-- <a href="#supabase-functions-new">supabase-functions-new</a>
+- <a href="#supabase-functions-deploy"><code>supabase functions deploy</code></a>
-- <a href="#supabase-functions-serve">supabase-functions-serve</a>
+- <a href="#supabase-functions-new"><code>supabase functions new</code></a>
+- <a href="#supabase-functions-serve"><code>supabase functions serve</code></a>
-### Options
+
+**Options**
```sh
-h, --help help for functions
@@ -587,12 +649,12 @@ supabase gen types typescript [flags]
<br /><br />
-## Serve a Function locally {#supabase-functions-serve}
+### Serve a Function locally {#supabase-functions-serve}
+
-### Usage
```sh
supabase functions serve <Function name> [flags]
@@ -600,7 +662,9 @@ supabase functions serve <Function name> [flags]
-### Options
+
+
+**Options**
```sh
--env-file string Path to an env file to be populated to the Function environment.
@@ -614,12 +678,12 @@ supabase functions serve <Function name> [flags]
<br /><br />
-## Create a new Function locally {#supabase-functions-new}
+### Create a new Function locally {#supabase-functions-new}
+
-### Usage
```sh
supabase functions new <Function name> [flags]
@@ -627,7 +691,9 @@ supabase functions new <Function name> [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for new
@@ -639,12 +705,12 @@ supabase functions new <Function name> [flags]
<br /><br />
-## Deploy a Function to the linked Supabase project {#supabase-functions-deploy}
+### Deploy a Function to Supabase {#supabase-functions-deploy}
+Deploy a Function to the linked Supabase project.
-### Usage
```sh
supabase functions deploy <Function name> [flags]
@@ -652,7 +718,9 @@ supabase functions deploy <Function name> [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for deploy
@@ -666,13 +734,13 @@ supabase functions deploy <Function name> [flags]
<br /><br />
-## Delete a Function from the linked Supabase project. This does NOT remove the Function locally.
- {#supabase-functions-delete}
+### Delete a Function from Supabase {#supabase-functions-delete}
+
+Delete a Function from the linked Supabase project. This does NOT remove the Function locally.
-### Usage
```sh
supabase functions delete <Function name> [flags]
@@ -680,7 +748,9 @@ supabase functions delete <Function name> [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for delete
@@ -698,27 +768,27 @@ supabase functions delete <Function name> [flags]
-### Usage
-### Available Commands
+**Available Commands**
-- <a href="#supabase-db-branch">supabase-db-branch</a>
-- <a href="#supabase-db-diff">supabase-db-diff</a>
+- <a href="#supabase-db-branch"><code>supabase db branch</code></a>
-- <a href="#supabase-db-push">supabase-db-push</a>
+- <a href="#supabase-db-diff"><code>supabase db diff</code></a>
-- <a href="#supabase-db-remote">supabase-db-remote</a>
+- <a href="#supabase-db-push"><code>supabase db push</code></a>
-- <a href="#supabase-db-reset">supabase-db-reset</a>
+- <a href="#supabase-db-remote"><code>supabase db remote</code></a>
+- <a href="#supabase-db-reset"><code>supabase db reset</code></a>
-### Options
+
+**Options**
```sh
-h, --help help for db
@@ -730,12 +800,12 @@ supabase functions delete <Function name> [flags]
<br /><br />
-## Resets the local database to current migrations {#supabase-db-reset}
+### Resets the local database to current migrations {#supabase-db-reset}
+
-### Usage
```sh
supabase db reset [flags]
@@ -743,7 +813,9 @@ supabase db reset [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for reset
@@ -755,31 +827,30 @@ supabase db reset [flags]
<br /><br />
-## Manage remote database connections {#supabase-db-remote}
+## Manage remote databases {#supabase-db-remote}
-### Usage
-### Available Commands
+**Available Commands**
-- <a href="#supabase-db-remote-changes">supabase-db-remote-changes</a>
-- <a href="#supabase-db-remote-commit">supabase-db-remote-commit</a>
+- <a href="#supabase-db-remote-changes"><code>supabase db remote changes</code></a>
-- <a href="#supabase-db-remote-set">supabase-db-remote-set</a>
+- <a href="#supabase-db-remote-commit"><code>supabase db remote commit</code></a>
-### Options
+**Options**
```sh
- -h, --help help for remote
+ -h, --help help for remote
+ -p, --password string Password to your remote Postgres database.
```
@@ -788,46 +859,22 @@ supabase db reset [flags]
<br /><br />
-## Set the remote database to push migrations to {#supabase-db-remote-set}
+### Commit remote changes as a new migration {#supabase-db-remote-commit}
-### Usage
-```sh
-supabase db remote set <remote database url> [flags]
-```
-
-
-
-### Options
```sh
- -h, --help help for set
+supabase db remote commit [flags]
```
-<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
-
-<br /><br />
-
-## Commit changes on the remote database since the last pushed migration
- {#supabase-db-remote-commit}
-
-
-
-
-### Usage
-
-```sh
-supabase db remote commit [flags]
-```
-
-### Options
+**Options**
```sh
-h, --help help for commit
@@ -839,13 +886,12 @@ supabase db remote commit [flags]
<br /><br />
-## Print changes on the remote database since the last pushed migration
- {#supabase-db-remote-changes}
+### Show changes on the remote database {#supabase-db-remote-changes}
+Show changes on the remote database since last migration.
-### Usage
```sh
supabase db remote changes [flags]
@@ -853,7 +899,9 @@ supabase db remote changes [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for changes
@@ -865,12 +913,12 @@ supabase db remote changes [flags]
<br /><br />
-## Push new migrations to the remote database {#supabase-db-push}
+### Push new migrations to the remote database {#supabase-db-push}
+
-### Usage
```sh
supabase db push [flags]
@@ -878,11 +926,14 @@ supabase db push [flags]
-### Options
+
+
+**Options**
```sh
- --dry-run Print the migrations that would be applied, but don't actually apply them.
- -h, --help help for push
+ --dry-run Print the migrations that would be applied, but don't actually apply them.
+ -h, --help help for push
+ -p, --password string Password to your remote Postgres database.
```
@@ -891,12 +942,12 @@ supabase db push [flags]
<br /><br />
-## Diffs the local database for schema changes {#supabase-db-diff}
+### Diffs the local database for schema changes {#supabase-db-diff}
+
-### Usage
```sh
supabase db diff [flags]
@@ -904,7 +955,9 @@ supabase db diff [flags]
-### Options
+
+
+**Options**
```sh
-f, --file string Saves schema diff to a file.
@@ -919,31 +972,31 @@ supabase db diff [flags]
<br /><br />
-## Manage branches. Each branch is associated with a separate database.
- {#supabase-db-branch}
+## Manage database branches {#supabase-db-branch}
+Manage database branches. Each branch is associated with a separate database.
-### Usage
-### Available Commands
+**Available Commands**
-- <a href="#supabase-db-branch-create">supabase-db-branch-create</a>
-- <a href="#supabase-db-branch-delete">supabase-db-branch-delete</a>
+- <a href="#supabase-db-branch-create"><code>supabase db branch create</code></a>
-- <a href="#supabase-db-branch-list">supabase-db-branch-list</a>
+- <a href="#supabase-db-branch-delete"><code>supabase db branch delete</code></a>
-- <a href="#supabase-db-branch-switch">supabase-db-branch-switch</a>
+- <a href="#supabase-db-branch-list"><code>supabase db branch list</code></a>
+- <a href="#supabase-db-branch-switch"><code>supabase db branch switch</code></a>
-### Options
+
+**Options**
```sh
-h, --help help for branch
@@ -955,12 +1008,12 @@ supabase db diff [flags]
<br /><br />
-## Switch the active branch {#supabase-db-branch-switch}
+### Switch the active branch {#supabase-db-branch-switch}
+
-### Usage
```sh
supabase db branch switch <branch name> [flags]
@@ -968,7 +1021,9 @@ supabase db branch switch <branch name> [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for switch
@@ -980,12 +1035,12 @@ supabase db branch switch <branch name> [flags]
<br /><br />
-## List branches {#supabase-db-branch-list}
+### List branches {#supabase-db-branch-list}
+
-### Usage
```sh
supabase db branch list [flags]
@@ -993,7 +1048,9 @@ supabase db branch list [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for list
@@ -1005,12 +1062,12 @@ supabase db branch list [flags]
<br /><br />
-## Delete a branch {#supabase-db-branch-delete}
+### Delete a branch {#supabase-db-branch-delete}
+
-### Usage
```sh
supabase db branch delete <branch name> [flags]
@@ -1018,7 +1075,9 @@ supabase db branch delete <branch name> [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for delete
@@ -1030,12 +1089,12 @@ supabase db branch delete <branch name> [flags]
<br /><br />
-## Create a branch {#supabase-db-branch-create}
+### Create a branch {#supabase-db-branch-create}
+
-### Usage
```sh
supabase db branch create <branch name> [flags]
@@ -1043,7 +1102,9 @@ supabase db branch create <branch name> [flags]
-### Options
+
+
+**Options**
```sh
-h, --help help for create
diff --git a/apps/reference/src/css/custom.css b/apps/reference/src/css/custom.css
index 352fca0433e..7bb9b269b7f 100644
--- a/apps/reference/src/css/custom.css
+++ b/apps/reference/src/css/custom.css
@@ -245,6 +245,8 @@
}
.markdown p a,
+.markdown p a code,
+.markdown li a code,
.markdown li a {
transition: box-shadow 0.1s ease-in-out;
padding-bottom: 2px;
@@ -252,6 +254,7 @@
box-shadow: var(--custom-primary) 0px -3px 0px -1px inset;
}
.markdown p a:hover,
+.markdown a:hover code,
.markdown li a:hover {
box-shadow: inset 0 -30px 0 -1px var(--custom-primary);
/* text-shadow: 0px 0px 3px var(--custom-primary-darkest); */
diff --git a/packages/spec/src/docs/cli.ts b/packages/spec/src/docs/cli.ts
index 85eddf84d9c..331747f4d75 100644
--- a/packages/spec/src/docs/cli.ts
+++ b/packages/spec/src/docs/cli.ts
@@ -26,7 +26,20 @@ export default async function gen(inputFileName: string, outputDir: string) {
* Versioned Generator
*/
async function gen_v001(spec: CliSpec, dest: string) {
- const commands = spec.commands
+ let commandMap = new Map(spec.commands.map((item) => [item.id, item]))
+
+ const commands = spec.commands.map((x) => {
+ const isChild = x.subcommands.length < 1
+ const heading = isChild
+ ? `### ${x.summary} {#${x.id}}`
+ : `## ${x.summary} {#${x.id}}`
+
+ return {
+ ...x,
+ heading,
+ subcommandList: x.subcommands.map((c) => commandMap.get(c)),
+ }
+ })
const content = ejs.render(template, {
info: spec.info,
diff --git a/packages/spec/src/docs/templates/CliTemplate.ts b/packages/spec/src/docs/templates/CliTemplate.ts
index 1f441e96fbf..5e7b1d629b2 100644
--- a/packages/spec/src/docs/templates/CliTemplate.ts
+++ b/packages/spec/src/docs/templates/CliTemplate.ts
@@ -2,6 +2,7 @@ const template = `
---
id: usage
title: Usage
+toc_max_heading_level: 3
---
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
@@ -14,24 +15,26 @@ title: Usage
<br /><br />
-## <%- command.summary %> {#<%- command.id %>}
+<%- command.heading %>
<%- command.description %>
-### Usage
+<% if(command.usage){ %>
<%- command.usage %>
+<% }; %>
+
<% if(command.subcommands.length > 0){ %>
-### Available Commands
+**Available Commands**
-<% command.subcommands.forEach(function(subcommand){ %>
-- <a href="#<%- subcommand %>"><%- subcommand %></a>
+<% command.subcommandList.forEach(function(subcommand){ %>
+- <a href="#<%- subcommand.id %>"><code><%- subcommand.title %></code></a>
<% }); %>
<% } %>
-### Options
+**Options**
<%- command.options %>