main.go 690 B

12345678910111213141516171819202122232425262728
  1. // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package main
  7. import (
  8. "github.com/gogf/gf/cmd/gf/v2/gfcmd"
  9. "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
  10. "github.com/gogf/gf/v2/errors/gerror"
  11. "github.com/gogf/gf/v2/os/gctx"
  12. )
  13. func main() {
  14. var (
  15. ctx = gctx.GetInitCtx()
  16. )
  17. command, err := gfcmd.GetCommand(ctx)
  18. if err != nil {
  19. mlog.Fatalf(`%+v`, err)
  20. }
  21. if command == nil {
  22. panic(gerror.New(`retrieve root command failed for "gf"`))
  23. }
  24. command.Run(ctx)
  25. }