feat: Add documentation generation and serve functionality

- Implement documentation generation
- Replace chi router with gin for documentation server
- Fix issues with docs command execution
This commit is contained in:
2025-11-04 19:15:28 +03:00
parent 3fc545f067
commit 5a8b53b49d
10 changed files with 206 additions and 100 deletions

View File

@@ -3,7 +3,7 @@ package args
import "git.ostiwe.com/ostiwe-com/status/version"
type ServerCmd struct {
Port string `arg:"-p,--port" help:"Port to listen on" default:"8080"`
Port string `arg:"-p,--port,env:APP_PORT" help:"Port to listen on" default:"8080"`
}
type MigrationCreate struct {
@@ -15,15 +15,23 @@ type Migration struct {
}
type ServerDocumentationCmd struct {
Port string `arg:"-p,--port" help:"Port to listen on" default:"8081"`
Plain bool `arg:"--plain" help:"Enable plain text output" default:"true"`
PlainFormat string `arg:"--plain-format" help:"Set format for output (json, yaml)" default:"yaml"`
Port string `arg:"-p,--port,env:APP_PORT_DOCS" help:"Port to listen on" default:"8081"`
}
type GenerateDocumentationCmd struct {
Format string `arg:"--format,-f" help:"Set output format (json, yaml)" default:"yaml"`
Out string `arg:"--out,-o" help:"Output file name (or stdout)" default:"stdout"`
}
type DocsCmd struct {
Serve *ServerDocumentationCmd `arg:"subcommand:serve" help:"Generate and serve the documentation server"`
Generate *GenerateDocumentationCmd `arg:"subcommand:generate" help:"Generate documentation to file"`
}
type AppArgs struct {
Server *ServerCmd `arg:"subcommand:server" help:"Start the api server"`
ServerDocumentation *ServerDocumentationCmd `arg:"subcommand:server-docs" help:"Generate documentation for api server and start documentation server"`
Migration *Migration `arg:"subcommand:migration" help:"Migration utils"`
Server *ServerCmd `arg:"subcommand:server" help:"Start the api server"`
Docs *DocsCmd `arg:"subcommand:docs" help:"Generate documentation to file or run documentation server"`
Migration *Migration `arg:"subcommand:migration" help:"Migration utils"`
}
func (AppArgs) Version() string {