main.go 804 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package main
  2. import (
  3. "fmt"
  4. "gogs.tyduyong.com/duyong/dy-pkg/app"
  5. "gogs.tyduyong.com/duyong/dy-pkg/app/flagsets"
  6. )
  7. const commandDesc = `pcm(phone cabinet manager) system command description`
  8. func main() {
  9. newApp("pcm").Run()
  10. }
  11. type Options struct {
  12. }
  13. func (o *Options) Flags() (fss flagsets.NamedFlagSets) {
  14. return fss
  15. }
  16. func (o *Options) Validate() []error {
  17. var errs []error
  18. return errs
  19. }
  20. func newApp(basename string) *app.App {
  21. opts := new(Options)
  22. application := app.NewApp("pcm server",
  23. basename,
  24. app.WithOptions(opts),
  25. app.WithNoConfig(),
  26. app.WithDescription(commandDesc),
  27. app.WithDefaultValidArgs(),
  28. app.WithRunFunc(run(opts)),
  29. )
  30. return application
  31. }
  32. func run(opts *Options) app.RunFunc {
  33. return func(basename string) error {
  34. fmt.Println(123)
  35. return nil
  36. }
  37. }