You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.go 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2016 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. // Gitea (git with a cup of tea) is a painless self-hosted Git Service.
  6. package main // import "code.gitea.io/gitea"
  7. import (
  8. "os"
  9. "strings"
  10. "code.gitea.io/gitea/cmd"
  11. "code.gitea.io/gitea/modules/log"
  12. "code.gitea.io/gitea/modules/setting"
  13. // register supported doc types
  14. _ "code.gitea.io/gitea/modules/markup/markdown"
  15. _ "code.gitea.io/gitea/modules/markup/orgmode"
  16. "github.com/urfave/cli"
  17. )
  18. // Version holds the current Gitea version
  19. var Version = "1.3.0-dev"
  20. // Tags holds the build tags used
  21. var Tags = ""
  22. func init() {
  23. setting.AppVer = Version
  24. setting.AppBuiltWith = formatBuiltWith(Tags)
  25. }
  26. func main() {
  27. app := cli.NewApp()
  28. app.Name = "Gitea"
  29. app.Usage = "A painless self-hosted Git service"
  30. app.Version = Version + formatBuiltWith(Tags)
  31. app.Commands = []cli.Command{
  32. cmd.CmdWeb,
  33. cmd.CmdServ,
  34. cmd.CmdHook,
  35. cmd.CmdDump,
  36. cmd.CmdCert,
  37. cmd.CmdAdmin,
  38. }
  39. app.Flags = append(app.Flags, []cli.Flag{}...)
  40. err := app.Run(os.Args)
  41. if err != nil {
  42. log.Fatal(4, "Failed to run app with %s: %v", os.Args, err)
  43. }
  44. }
  45. func formatBuiltWith(Tags string) string {
  46. if len(Tags) == 0 {
  47. return ""
  48. }
  49. return " built with: " + strings.Replace(Tags, " ", ", ", -1)
  50. }