diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 747e66df..3d60e813 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,6 +6,11 @@ ## Development Checklist + + - [ ] I have added a descriptive title to this PR. - [ ] I have squashed related commits together. - [ ] I have rebased my branch on top of the latest main branch. @@ -13,6 +18,7 @@ - [ ] I have commented on my code, particularly in hard-to-understand areas. - [ ] I have added docstring(s) to my code. - [ ] I have made corresponding changes to the documentation (docs). +- [ ] I have updated docs using `make gen-docs` command. - [ ] I have added tests for my changes. - [ ] I have signed all the commits. diff --git a/Makefile b/Makefile index 215ced5f..4e1e234a 100644 --- a/Makefile +++ b/Makefile @@ -128,3 +128,6 @@ gen: update: @buf mod update + +gen-docs: + @go run main.go gen-docs \ No newline at end of file diff --git a/cmd/gen_docs.go b/cmd/gen_docs.go new file mode 100644 index 00000000..19a08e42 --- /dev/null +++ b/cmd/gen_docs.go @@ -0,0 +1,29 @@ +package cmd + +import ( + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" +) + +var docOutputDir string + +var genDocs = &cobra.Command{ + Use: "gen-docs", + Short: "Generate markdown documentation", + Hidden: true, + Run: func(cmd *cobra.Command, _ []string) { + err := doc.GenMarkdownTree(rootCmd, docOutputDir) + if err != nil { + cmd.PrintErr(err) + } + }, +} + +func init() { + rootCmd.AddCommand(genDocs) + + genDocs.Flags().StringVarP( + &docOutputDir, + "output-dir", "o", "./docs", + "Output directory for markdown files") +} diff --git a/docs/gatewayd.md b/docs/gatewayd.md new file mode 100644 index 00000000..75adb466 --- /dev/null +++ b/docs/gatewayd.md @@ -0,0 +1,23 @@ +## gatewayd + +A cloud-native database gateway and framework for building data-driven applications + +### Synopsis + +GatewayD is a cloud-native database gateway and framework for building data-driven applications. It sits between your database servers and clients and proxies all their communication. + +### Options + +``` + -h, --help help for gatewayd +``` + +### SEE ALSO + +* [gatewayd completion](gatewayd_completion.md) - Generate the autocompletion script for the specified shell +* [gatewayd config](gatewayd_config.md) - Manage GatewayD global configuration +* [gatewayd plugin](gatewayd_plugin.md) - Manage plugins and their configuration +* [gatewayd run](gatewayd_run.md) - Run a GatewayD instance +* [gatewayd version](gatewayd_version.md) - Show version information + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_completion.md b/docs/gatewayd_completion.md new file mode 100644 index 00000000..24795e37 --- /dev/null +++ b/docs/gatewayd_completion.md @@ -0,0 +1,25 @@ +## gatewayd completion + +Generate the autocompletion script for the specified shell + +### Synopsis + +Generate the autocompletion script for gatewayd for the specified shell. +See each sub-command's help for details on how to use the generated script. + + +### Options + +``` + -h, --help help for completion +``` + +### SEE ALSO + +* [gatewayd](gatewayd.md) - A cloud-native database gateway and framework for building data-driven applications +* [gatewayd completion bash](gatewayd_completion_bash.md) - Generate the autocompletion script for bash +* [gatewayd completion fish](gatewayd_completion_fish.md) - Generate the autocompletion script for fish +* [gatewayd completion powershell](gatewayd_completion_powershell.md) - Generate the autocompletion script for powershell +* [gatewayd completion zsh](gatewayd_completion_zsh.md) - Generate the autocompletion script for zsh + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_completion_bash.md b/docs/gatewayd_completion_bash.md new file mode 100644 index 00000000..308106b1 --- /dev/null +++ b/docs/gatewayd_completion_bash.md @@ -0,0 +1,44 @@ +## gatewayd completion bash + +Generate the autocompletion script for bash + +### Synopsis + +Generate the autocompletion script for the bash shell. + +This script depends on the 'bash-completion' package. +If it is not installed already, you can install it via your OS's package manager. + +To load completions in your current shell session: + + source <(gatewayd completion bash) + +To load completions for every new session, execute once: + +#### Linux: + + gatewayd completion bash > /etc/bash_completion.d/gatewayd + +#### macOS: + + gatewayd completion bash > $(brew --prefix)/etc/bash_completion.d/gatewayd + +You will need to start a new shell for this setup to take effect. + + +``` +gatewayd completion bash +``` + +### Options + +``` + -h, --help help for bash + --no-descriptions disable completion descriptions +``` + +### SEE ALSO + +* [gatewayd completion](gatewayd_completion.md) - Generate the autocompletion script for the specified shell + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_completion_fish.md b/docs/gatewayd_completion_fish.md new file mode 100644 index 00000000..102fec44 --- /dev/null +++ b/docs/gatewayd_completion_fish.md @@ -0,0 +1,35 @@ +## gatewayd completion fish + +Generate the autocompletion script for fish + +### Synopsis + +Generate the autocompletion script for the fish shell. + +To load completions in your current shell session: + + gatewayd completion fish | source + +To load completions for every new session, execute once: + + gatewayd completion fish > ~/.config/fish/completions/gatewayd.fish + +You will need to start a new shell for this setup to take effect. + + +``` +gatewayd completion fish [flags] +``` + +### Options + +``` + -h, --help help for fish + --no-descriptions disable completion descriptions +``` + +### SEE ALSO + +* [gatewayd completion](gatewayd_completion.md) - Generate the autocompletion script for the specified shell + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_completion_powershell.md b/docs/gatewayd_completion_powershell.md new file mode 100644 index 00000000..0c8b9e13 --- /dev/null +++ b/docs/gatewayd_completion_powershell.md @@ -0,0 +1,32 @@ +## gatewayd completion powershell + +Generate the autocompletion script for powershell + +### Synopsis + +Generate the autocompletion script for powershell. + +To load completions in your current shell session: + + gatewayd completion powershell | Out-String | Invoke-Expression + +To load completions for every new session, add the output of the above command +to your powershell profile. + + +``` +gatewayd completion powershell [flags] +``` + +### Options + +``` + -h, --help help for powershell + --no-descriptions disable completion descriptions +``` + +### SEE ALSO + +* [gatewayd completion](gatewayd_completion.md) - Generate the autocompletion script for the specified shell + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_completion_zsh.md b/docs/gatewayd_completion_zsh.md new file mode 100644 index 00000000..0bc3fd61 --- /dev/null +++ b/docs/gatewayd_completion_zsh.md @@ -0,0 +1,46 @@ +## gatewayd completion zsh + +Generate the autocompletion script for zsh + +### Synopsis + +Generate the autocompletion script for the zsh shell. + +If shell completion is not already enabled in your environment you will need +to enable it. You can execute the following once: + + echo "autoload -U compinit; compinit" >> ~/.zshrc + +To load completions in your current shell session: + + source <(gatewayd completion zsh) + +To load completions for every new session, execute once: + +#### Linux: + + gatewayd completion zsh > "${fpath[1]}/_gatewayd" + +#### macOS: + + gatewayd completion zsh > $(brew --prefix)/share/zsh/site-functions/_gatewayd + +You will need to start a new shell for this setup to take effect. + + +``` +gatewayd completion zsh [flags] +``` + +### Options + +``` + -h, --help help for zsh + --no-descriptions disable completion descriptions +``` + +### SEE ALSO + +* [gatewayd completion](gatewayd_completion.md) - Generate the autocompletion script for the specified shell + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_config.md b/docs/gatewayd_config.md new file mode 100644 index 00000000..e77dc214 --- /dev/null +++ b/docs/gatewayd_config.md @@ -0,0 +1,21 @@ +## gatewayd config + +Manage GatewayD global configuration + +``` +gatewayd config [flags] +``` + +### Options + +``` + -h, --help help for config +``` + +### SEE ALSO + +* [gatewayd](gatewayd.md) - A cloud-native database gateway and framework for building data-driven applications +* [gatewayd config init](gatewayd_config_init.md) - Create or overwrite the GatewayD global config +* [gatewayd config lint](gatewayd_config_lint.md) - Lint the GatewayD global config + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_config_init.md b/docs/gatewayd_config_init.md new file mode 100644 index 00000000..d607b18f --- /dev/null +++ b/docs/gatewayd_config_init.md @@ -0,0 +1,22 @@ +## gatewayd config init + +Create or overwrite the GatewayD global config + +``` +gatewayd config init [flags] +``` + +### Options + +``` + -c, --config string Global config file (default "gatewayd.yaml") + -f, --force Force overwrite of existing config file + -h, --help help for init + --sentry Enable Sentry (default true) +``` + +### SEE ALSO + +* [gatewayd config](gatewayd_config.md) - Manage GatewayD global configuration + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_config_lint.md b/docs/gatewayd_config_lint.md new file mode 100644 index 00000000..d2d9cb4b --- /dev/null +++ b/docs/gatewayd_config_lint.md @@ -0,0 +1,21 @@ +## gatewayd config lint + +Lint the GatewayD global config + +``` +gatewayd config lint [flags] +``` + +### Options + +``` + -c, --config string Global config file (default "gatewayd.yaml") + -h, --help help for lint + --sentry Enable Sentry (default true) +``` + +### SEE ALSO + +* [gatewayd config](gatewayd_config.md) - Manage GatewayD global configuration + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_plugin.md b/docs/gatewayd_plugin.md new file mode 100644 index 00000000..49f6558e --- /dev/null +++ b/docs/gatewayd_plugin.md @@ -0,0 +1,23 @@ +## gatewayd plugin + +Manage plugins and their configuration + +``` +gatewayd plugin [flags] +``` + +### Options + +``` + -h, --help help for plugin +``` + +### SEE ALSO + +* [gatewayd](gatewayd.md) - A cloud-native database gateway and framework for building data-driven applications +* [gatewayd plugin init](gatewayd_plugin_init.md) - Create or overwrite the GatewayD plugins config +* [gatewayd plugin install](gatewayd_plugin_install.md) - Install a plugin from a local archive or a GitHub repository +* [gatewayd plugin lint](gatewayd_plugin_lint.md) - Lint the GatewayD plugins config +* [gatewayd plugin list](gatewayd_plugin_list.md) - List the GatewayD plugins + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_plugin_init.md b/docs/gatewayd_plugin_init.md new file mode 100644 index 00000000..adeaf28a --- /dev/null +++ b/docs/gatewayd_plugin_init.md @@ -0,0 +1,22 @@ +## gatewayd plugin init + +Create or overwrite the GatewayD plugins config + +``` +gatewayd plugin init [flags] +``` + +### Options + +``` + -f, --force Force overwrite of existing config file + -h, --help help for init + -p, --plugin-config string Plugin config file (default "gatewayd_plugins.yaml") + --sentry Enable Sentry (default true) +``` + +### SEE ALSO + +* [gatewayd plugin](gatewayd_plugin.md) - Manage plugins and their configuration + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_plugin_install.md b/docs/gatewayd_plugin_install.md new file mode 100644 index 00000000..31ab0619 --- /dev/null +++ b/docs/gatewayd_plugin_install.md @@ -0,0 +1,36 @@ +## gatewayd plugin install + +Install a plugin from a local archive or a GitHub repository + +``` +gatewayd plugin install [flags] +``` + +### Examples + +``` + gatewayd plugin install +``` + +### Options + +``` + --backup Backup the plugins configuration file before installing the plugin + --cleanup Delete downloaded and extracted files after installing the plugin (except the plugin binary) (default true) + -h, --help help for install + -n, --name string Name of the plugin (only for installing from archive files) + --no-prompt Do not prompt for user input (default true) + -o, --output-dir string Output directory for the plugin (default "./plugins") + --overwrite-config Overwrite the existing plugins configuration file (overrides --update, only used for installing from the plugins configuration file) (default true) + -p, --plugin-config string Plugin config file (default "gatewayd_plugins.yaml") + --pull-only Only pull the plugin, don't install it + --sentry Enable Sentry (default true) + --skip-path-slip-verification Skip path slip verification when extracting the plugin archive from a TRUSTED source + --update Update the plugin if it already exists +``` + +### SEE ALSO + +* [gatewayd plugin](gatewayd_plugin.md) - Manage plugins and their configuration + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_plugin_lint.md b/docs/gatewayd_plugin_lint.md new file mode 100644 index 00000000..9333a6a3 --- /dev/null +++ b/docs/gatewayd_plugin_lint.md @@ -0,0 +1,21 @@ +## gatewayd plugin lint + +Lint the GatewayD plugins config + +``` +gatewayd plugin lint [flags] +``` + +### Options + +``` + -h, --help help for lint + -p, --plugin-config string Plugin config file (default "gatewayd_plugins.yaml") + --sentry Enable Sentry (default true) +``` + +### SEE ALSO + +* [gatewayd plugin](gatewayd_plugin.md) - Manage plugins and their configuration + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_plugin_list.md b/docs/gatewayd_plugin_list.md new file mode 100644 index 00000000..39d43a1f --- /dev/null +++ b/docs/gatewayd_plugin_list.md @@ -0,0 +1,22 @@ +## gatewayd plugin list + +List the GatewayD plugins + +``` +gatewayd plugin list [flags] +``` + +### Options + +``` + -h, --help help for list + -e, --only-enabled Only list enabled plugins + -p, --plugin-config string Plugin config file (default "gatewayd_plugins.yaml") + --sentry Enable Sentry (default true) +``` + +### SEE ALSO + +* [gatewayd plugin](gatewayd_plugin.md) - Manage plugins and their configuration + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_run.md b/docs/gatewayd_run.md new file mode 100644 index 00000000..326def3c --- /dev/null +++ b/docs/gatewayd_run.md @@ -0,0 +1,27 @@ +## gatewayd run + +Run a GatewayD instance + +``` +gatewayd run [flags] +``` + +### Options + +``` + --collector-url string Collector URL of OpenTelemetry gRPC endpoint (default "localhost:4317") + -c, --config string Global config file (default "gatewayd.yaml") + --dev Enable development mode for plugin development + -h, --help help for run + --lint Enable linting of configuration files (default true) + -p, --plugin-config string Plugin config file (default "gatewayd_plugins.yaml") + --sentry Enable Sentry (default true) + --tracing Enable tracing with OpenTelemetry via gRPC + --usage-report Enable usage report (default true) +``` + +### SEE ALSO + +* [gatewayd](gatewayd.md) - A cloud-native database gateway and framework for building data-driven applications + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/docs/gatewayd_version.md b/docs/gatewayd_version.md new file mode 100644 index 00000000..133e62a0 --- /dev/null +++ b/docs/gatewayd_version.md @@ -0,0 +1,19 @@ +## gatewayd version + +Show version information + +``` +gatewayd version [flags] +``` + +### Options + +``` + -h, --help help for version +``` + +### SEE ALSO + +* [gatewayd](gatewayd.md) - A cloud-native database gateway and framework for building data-driven applications + +###### Auto generated by spf13/cobra on 8-Mar-2024 diff --git a/go.mod b/go.mod index 443b58e1..b52cb68b 100644 --- a/go.mod +++ b/go.mod @@ -48,6 +48,7 @@ require ( github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cloudflare/circl v1.3.7 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/expr-lang/expr v1.16.1 // indirect github.com/fatih/color v1.16.0 // indirect @@ -72,6 +73,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/tetratelabs/wazero v1.6.1-0.20240124004658-4185e533bb18 // indirect github.com/wasilibs/go-pgquery v0.0.0-20240124010238-c9a912d768dc // indirect diff --git a/go.sum b/go.sum index 74becf22..0072df5e 100644 --- a/go.sum +++ b/go.sum @@ -56,6 +56,7 @@ github.com/codingsince1985/checksum v1.3.0/go.mod h1:QfRskdtdWap+gJil8e5obw6I8/c github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -340,6 +341,7 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=