- Implement documentation generation - Replace chi router with gin for documentation server - Fix issues with docs command execution
40 lines
1.3 KiB
Go
40 lines
1.3 KiB
Go
package args
|
|
|
|
import "git.ostiwe.com/ostiwe-com/status/version"
|
|
|
|
type ServerCmd struct {
|
|
Port string `arg:"-p,--port,env:APP_PORT" help:"Port to listen on" default:"8080"`
|
|
}
|
|
|
|
type MigrationCreate struct {
|
|
Name string `arg:"-n,--name" help:"Name of migration"`
|
|
}
|
|
|
|
type Migration struct {
|
|
Create *MigrationCreate `arg:"subcommand:create" help:"Create migration"`
|
|
}
|
|
|
|
type ServerDocumentationCmd struct {
|
|
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"`
|
|
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 {
|
|
return version.AppVersion()
|
|
}
|