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.6KB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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.5.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.Description = `By default, gitea will start serving using the webserver with no
  31. arguments - which can alternatively be run by running the subcommand web.`
  32. app.Version = Version + formatBuiltWith(Tags)
  33. app.Commands = []cli.Command{
  34. cmd.CmdWeb,
  35. cmd.CmdServ,
  36. cmd.CmdHook,
  37. cmd.CmdDump,
  38. cmd.CmdCert,
  39. cmd.CmdAdmin,
  40. cmd.CmdGenerate,
  41. }
  42. app.Flags = append(app.Flags, []cli.Flag{}...)
  43. app.Action = cmd.CmdWeb.Action
  44. err := app.Run(os.Args)
  45. if err != nil {
  46. log.Fatal(4, "Failed to run app with %s: %v", os.Args, err)
  47. }
  48. }
  49. func formatBuiltWith(Tags string) string {
  50. if len(Tags) == 0 {
  51. return ""
  52. }
  53. return " built with: " + strings.Replace(Tags, " ", ", ", -1)
  54. }