Skip to content

Commit

Permalink
docs(cmd): Help text tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Aug 1, 2024
1 parent 15656f2 commit feb33e3
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 32 deletions.
1 change: 1 addition & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func NewCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "kubedb",
Short: "Painlessly work with databases in Kubernetes.",
Long: newDescription(),
Version: buildVersion(),
DisableAutoGenTag: true,

Expand Down
16 changes: 16 additions & 0 deletions cmd/description.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cmd

import (
"strings"

"github.com/clevyr/kubedb/internal/database"
)

func newDescription() string {
dbs := database.Names()

return `Painlessly work with databases in Kubernetes.
Supported Databases:
` + strings.Join(dbs, ", ")
}
17 changes: 9 additions & 8 deletions cmd/dump/description.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ func newDescription() string {

return `Dump a database to a sql file.
Databases: ` + strings.Join(dbs, ", ") + `
Supported Databases:
` + strings.Join(dbs, ", ") + `
File Path:
- If the path is not provided, a filename will be generated.
- If the path is a file, the database will be dumped there.
- If the path is a directory, the database will be dumped to a generated filename in that directory.
- Filenames are autogenerated based on the namespace and timestamp.
- If the path is not provided, a filename will be generated.
- If the path is a file, the database will be dumped there.
- If the path is a directory, the database will be dumped to a generated filename in that directory.
- Filenames are autogenerated based on the namespace and timestamp.
Cloud Upload:
- Use ` + "`s3://`" + ` for S3 and ` + "`gs://`" + ` for GCS.
- If the URL only contains a bucket name or if the path ends with ` + "`/`" + `, then filenames are autogenerated similarly to local dumps.
- Cloud config is loaded from the environment (similar to the ` + "`aws` and `gcloud`" + ` tools).
- Use "s3://" for S3 and "gs://" for GCS.
- If the URL only contains a bucket name or if the path ends with "/", then filenames are autogenerated similarly to local dumps.
- Cloud config is loaded from the environment (similar to the awsgcloud tools).
`
}
5 changes: 3 additions & 2 deletions cmd/exec/description.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
func newDescription() string {
dbs := database.NamesForInterface[config.DBExecer]()

return `Connect to an interactive shell
return `Connect to an interactive shell.
Databases: ` + strings.Join(dbs, ", ")
Supported Databases:
` + strings.Join(dbs, ", ")
}
5 changes: 3 additions & 2 deletions cmd/portforward/description.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
func newDescription() string {
dbs := database.NamesForInterface[config.DBHasPort]()

return `Set up a local port forward
return `Set up a local port forward.
Databases: ` + strings.Join(dbs, ", ")
Supported Databases:
` + strings.Join(dbs, ", ")
}
9 changes: 5 additions & 4 deletions cmd/restore/description.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ func newDescription() string {

return `Restore a sql file to a database.
Databases: ` + strings.Join(dbs, ", ") + `
Supported Databases:
` + strings.Join(dbs, ", ") + `
Supported Input Filetypes:
- Raw sql file. Typically with the ` + "`" + `.sql` + "`" + ` extension
- Gzipped sql file. Typically with the ".sql.gz" extension
- For Postgres: custom dump file. Typically with the ".dmp" extension`
- Raw sql file. Typically with a ".sql" file extension
- Gzipped sql file. Typically with a ".sql.gz" file extension
- For Postgres: custom dump file. Typically with a ".dmp" file extension`
}
7 changes: 7 additions & 0 deletions docs/kubedb.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Painlessly work with databases in Kubernetes.

### Synopsis

Painlessly work with databases in Kubernetes.

Supported Databases:
postgres, mariadb, mongodb, redis, meilisearch

### Options

```
Expand Down
17 changes: 9 additions & 8 deletions docs/kubedb_dump.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ Dump a database to a sql file

Dump a database to a sql file.

Databases: postgres, mariadb, mongodb, meilisearch
Supported Databases:
postgres, mariadb, mongodb, meilisearch

File Path:
- If the path is not provided, a filename will be generated.
- If the path is a file, the database will be dumped there.
- If the path is a directory, the database will be dumped to a generated filename in that directory.
- Filenames are autogenerated based on the namespace and timestamp.
- If the path is not provided, a filename will be generated.
- If the path is a file, the database will be dumped there.
- If the path is a directory, the database will be dumped to a generated filename in that directory.
- Filenames are autogenerated based on the namespace and timestamp.

Cloud Upload:
- Use `s3://` for S3 and `gs://` for GCS.
- If the URL only contains a bucket name or if the path ends with `/`, then filenames are autogenerated similarly to local dumps.
- Cloud config is loaded from the environment (similar to the `aws` and `gcloud` tools).
- Use "s3://" for S3 and "gs://" for GCS.
- If the URL only contains a bucket name or if the path ends with "/", then filenames are autogenerated similarly to local dumps.
- Cloud config is loaded from the environment (similar to the awsgcloud tools).


```
Expand Down
5 changes: 3 additions & 2 deletions docs/kubedb_exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Connect to an interactive shell

### Synopsis

Connect to an interactive shell
Connect to an interactive shell.

Databases: postgres, mariadb, mongodb, redis
Supported Databases:
postgres, mariadb, mongodb, redis

```
kubedb exec [flags]
Expand Down
5 changes: 3 additions & 2 deletions docs/kubedb_port-forward.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Set up a local port forward

### Synopsis

Set up a local port forward
Set up a local port forward.

Databases: postgres, mariadb, mongodb, redis, meilisearch
Supported Databases:
postgres, mariadb, mongodb, redis, meilisearch

```
kubedb port-forward [local_port] [flags]
Expand Down
9 changes: 5 additions & 4 deletions docs/kubedb_restore.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ Restore a sql file to a database

Restore a sql file to a database.

Databases: postgres, mariadb, mongodb, meilisearch
Supported Databases:
postgres, mariadb, mongodb, meilisearch

Supported Input Filetypes:
- Raw sql file. Typically with the `.sql` extension
- Gzipped sql file. Typically with the ".sql.gz" extension
- For Postgres: custom dump file. Typically with the ".dmp" extension
- Raw sql file. Typically with a ".sql" file extension
- Gzipped sql file. Typically with a ".sql.gz" file extension
- For Postgres: custom dump file. Typically with a ".dmp" file extension

```
kubedb restore filename [flags]
Expand Down

0 comments on commit feb33e3

Please sign in to comment.