Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions cmd/generate-docs/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package main

import (
"bytes"
"flag"
"fmt"
"io/fs"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -63,6 +65,11 @@ func main() {
log.Fatal(err)
}
}
// Cobra's markdown generator leaves a trailing blank line on every
// file. Strip it so `git diff --check` doesn't flag the EOF.
if err := trimTrailingBlankLines(*out, ".md"); err != nil {
log.Fatal(err)
}
case "man":
hdr := &doc.GenManHeader{Title: strings.ToUpper(root.Name()), Section: "1"}
if err := doc.GenManTree(root, hdr, *out); err != nil {
Expand All @@ -80,3 +87,27 @@ func main() {
log.Fatalf("unknown format: %s", *format)
}
}

func trimTrailingBlankLines(dir, ext string) error {
return filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if d.IsDir() || filepath.Ext(path) != ext {
return nil
}
data, err := os.ReadFile(path)
if err != nil {
return err
}
trimmed := append(bytes.TrimRight(data, "\n"), '\n')
if bytes.Equal(trimmed, data) {
return nil
}
info, err := d.Info()
if err != nil {
return err
}
return os.WriteFile(path, trimmed, info.Mode().Perm())
})
}
1 change: 0 additions & 1 deletion docs/cli/ghost.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ Ghost is a command-line interface for managing PostgreSQL databases.
* [ghost status](ghost_status.md) - Show space usage
* [ghost upgrade](ghost_upgrade.md) - Upgrade the ghost CLI to the latest version
* [ghost version](ghost_version.md) - Show version information

1 change: 0 additions & 1 deletion docs/cli/ghost_api-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ GHOST_API_KEY environment variable.
* [ghost api-key create](ghost_api-key_create.md) - Create a new API key
* [ghost api-key delete](ghost_api-key_delete.md) - Delete an API key
* [ghost api-key list](ghost_api-key_list.md) - List API keys

1 change: 0 additions & 1 deletion docs/cli/ghost_api-key_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ ghost api-key create [flags]
### SEE ALSO

* [ghost api-key](ghost_api-key.md) - Manage API keys

1 change: 0 additions & 1 deletion docs/cli/ghost_api-key_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ ghost api-key delete <prefix> [flags]
### SEE ALSO

* [ghost api-key](ghost_api-key.md) - Manage API keys

1 change: 0 additions & 1 deletion docs/cli/ghost_api-key_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ ghost api-key list [flags]
### SEE ALSO

* [ghost api-key](ghost_api-key.md) - Manage API keys

1 change: 0 additions & 1 deletion docs/cli/ghost_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ ghost config [flags]
* [ghost config reset](ghost_config_reset.md) - Reset to defaults
* [ghost config set](ghost_config_set.md) - Set configuration value
* [ghost config unset](ghost_config_unset.md) - Remove configuration value

1 change: 0 additions & 1 deletion docs/cli/ghost_config_reset.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ ghost config reset [flags]
### SEE ALSO

* [ghost config](ghost_config.md) - List current configuration

1 change: 0 additions & 1 deletion docs/cli/ghost_config_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ ghost config set <key> <value> [flags]
### SEE ALSO

* [ghost config](ghost_config.md) - List current configuration

1 change: 0 additions & 1 deletion docs/cli/ghost_config_unset.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ ghost config unset <key> [flags]
### SEE ALSO

* [ghost config](ghost_config.md) - List current configuration

1 change: 0 additions & 1 deletion docs/cli/ghost_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ ghost connect <name-or-id> [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ ghost create [flags]

* [ghost](ghost.md) - CLI for managing Postgres databases
* [ghost create dedicated](ghost_create_dedicated.md) - Create a dedicated database

1 change: 0 additions & 1 deletion docs/cli/ghost_create_dedicated.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,3 @@ ghost create dedicated [flags]
### SEE ALSO

* [ghost create](ghost_create.md) - Create a new Postgres database

1 change: 0 additions & 1 deletion docs/cli/ghost_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ ghost delete <name-or-id> [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ ghost feedback [message] [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ ghost fork <name-or-id> [flags]

* [ghost](ghost.md) - CLI for managing Postgres databases
* [ghost fork dedicated](ghost_fork_dedicated.md) - Fork a database as dedicated

1 change: 0 additions & 1 deletion docs/cli/ghost_fork_dedicated.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ ghost fork dedicated <name-or-id> [flags]
### SEE ALSO

* [ghost fork](ghost_fork.md) - Fork a database

1 change: 0 additions & 1 deletion docs/cli/ghost_invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ View invoices for your Ghost space.
* [ghost](ghost.md) - CLI for managing Postgres databases
* [ghost invoice list](ghost_invoice_list.md) - List invoices
* [ghost invoice view](ghost_invoice_view.md) - View invoice detail

1 change: 0 additions & 1 deletion docs/cli/ghost_invoice_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ ghost invoice list [flags]
### SEE ALSO

* [ghost invoice](ghost_invoice.md) - View invoices

1 change: 0 additions & 1 deletion docs/cli/ghost_invoice_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ ghost invoice view <invoice-id> [flags]
### SEE ALSO

* [ghost invoice](ghost_invoice.md) - View invoices

1 change: 0 additions & 1 deletion docs/cli/ghost_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ ghost list [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_login.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ ghost login [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_logout.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ ghost logout [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ ghost logs <name-or-id> [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ Exposes Ghost CLI functionality as MCP tools for Claude and other AI assistants.
* [ghost mcp start](ghost_mcp_start.md) - Start the Ghost MCP server
* [ghost mcp status](ghost_mcp_status.md) - Show Ghost MCP configuration status for supported clients
* [ghost mcp uninstall](ghost_mcp_uninstall.md) - Uninstall Ghost MCP server configuration from a client

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ ghost mcp get <name> [flags]
### SEE ALSO

* [ghost mcp](ghost_mcp.md) - Ghost Model Context Protocol (MCP) server

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ ghost mcp install [client] [flags]
### SEE ALSO

* [ghost mcp](ghost_mcp.md) - Ghost Model Context Protocol (MCP) server

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ ghost mcp list [flags]
### SEE ALSO

* [ghost mcp](ghost_mcp.md) - Ghost Model Context Protocol (MCP) server

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ ghost mcp start [flags]
* [ghost mcp](ghost_mcp.md) - Ghost Model Context Protocol (MCP) server
* [ghost mcp start http](ghost_mcp_start_http.md) - Start MCP server with HTTP transport
* [ghost mcp start stdio](ghost_mcp_start_stdio.md) - Start MCP server with stdio transport

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_start_http.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ ghost mcp start http [flags]
### SEE ALSO

* [ghost mcp start](ghost_mcp_start.md) - Start the Ghost MCP server

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_start_stdio.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ ghost mcp start stdio [flags]
### SEE ALSO

* [ghost mcp start](ghost_mcp_start.md) - Start the Ghost MCP server

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ ghost mcp status [client] [flags]
### SEE ALSO

* [ghost mcp](ghost_mcp.md) - Ghost Model Context Protocol (MCP) server

1 change: 0 additions & 1 deletion docs/cli/ghost_mcp_uninstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,3 @@ ghost mcp uninstall [client] [flags]
### SEE ALSO

* [ghost mcp](ghost_mcp.md) - Ghost Model Context Protocol (MCP) server

1 change: 0 additions & 1 deletion docs/cli/ghost_password.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ ghost password <name-or-id> [new-password] [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_pause.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ ghost pause <name-or-id> [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ ghost payment [flags]
* [ghost payment list](ghost_payment_list.md) - List payment methods
* [ghost payment primary](ghost_payment_primary.md) - Set the primary payment method
* [ghost payment undelete](ghost_payment_undelete.md) - Cancel a pending payment method deletion

1 change: 0 additions & 1 deletion docs/cli/ghost_payment_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ ghost payment add [flags]
### SEE ALSO

* [ghost payment](ghost_payment.md) - Manage payment methods

1 change: 0 additions & 1 deletion docs/cli/ghost_payment_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ ghost payment delete <payment-id> [flags]
### SEE ALSO

* [ghost payment](ghost_payment.md) - Manage payment methods

1 change: 0 additions & 1 deletion docs/cli/ghost_payment_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ ghost payment list [flags]
### SEE ALSO

* [ghost payment](ghost_payment.md) - Manage payment methods

1 change: 0 additions & 1 deletion docs/cli/ghost_payment_primary.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ ghost payment primary <payment-id> [flags]
### SEE ALSO

* [ghost payment](ghost_payment.md) - Manage payment methods

1 change: 0 additions & 1 deletion docs/cli/ghost_payment_undelete.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ ghost payment undelete <payment-id> [flags]
### SEE ALSO

* [ghost payment](ghost_payment.md) - Manage payment methods

1 change: 0 additions & 1 deletion docs/cli/ghost_pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ ghost pricing [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_psql.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ ghost psql <name-or-id> [-- <psql-flags>...] [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_rename.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ ghost rename <name-or-id> <new-name> [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_resume.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ ghost resume <name-or-id> [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ ghost schema <name-or-id> [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_share.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ ghost share <name-or-id> [flags]
* [ghost](ghost.md) - CLI for managing Postgres databases
* [ghost share list](ghost_share_list.md) - List database shares
* [ghost share revoke](ghost_share_revoke.md) - Revoke a database share

1 change: 0 additions & 1 deletion docs/cli/ghost_share_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ ghost share list [flags]
### SEE ALSO

* [ghost share](ghost_share.md) - Share a database

1 change: 0 additions & 1 deletion docs/cli/ghost_share_revoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ ghost share revoke <share-token> [flags]
### SEE ALSO

* [ghost share](ghost_share.md) - Share a database

1 change: 0 additions & 1 deletion docs/cli/ghost_sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ ghost sql <name-or-id> [query] [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_status.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ ghost status [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ ghost upgrade [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases

1 change: 0 additions & 1 deletion docs/cli/ghost_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ ghost version [flags]
### SEE ALSO

* [ghost](ghost.md) - CLI for managing Postgres databases