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.

68 lines
1.7 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  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/csv"
  15. _ "code.gitea.io/gitea/modules/markup/markdown"
  16. _ "code.gitea.io/gitea/modules/markup/orgmode"
  17. "github.com/urfave/cli"
  18. )
  19. // Version holds the current Gitea version
  20. var Version = "1.5.0-dev"
  21. // Tags holds the build tags used
  22. var Tags = ""
  23. func init() {
  24. setting.AppVer = Version
  25. setting.AppBuiltWith = formatBuiltWith(Tags)
  26. }
  27. func main() {
  28. app := cli.NewApp()
  29. app.Name = "Gitea"
  30. app.Usage = "A painless self-hosted Git service"
  31. app.Description = `By default, gitea will start serving using the webserver with no
  32. arguments - which can alternatively be run by running the subcommand web.`
  33. app.Version = Version + formatBuiltWith(Tags)
  34. app.Commands = []cli.Command{
  35. cmd.CmdWeb,
  36. cmd.CmdServ,
  37. cmd.CmdHook,
  38. cmd.CmdDump,
  39. cmd.CmdCert,
  40. cmd.CmdAdmin,
  41. cmd.CmdGenerate,
  42. cmd.CmdMigrate,
  43. cmd.CmdKeys,
  44. }
  45. app.Flags = append(app.Flags, cmd.CmdWeb.Flags...)
  46. app.Action = cmd.CmdWeb.Action
  47. err := app.Run(os.Args)
  48. if err != nil {
  49. log.Fatal(4, "Failed to run app with %s: %v", os.Args, err)
  50. }
  51. }
  52. func formatBuiltWith(Tags string) string {
  53. if len(Tags) == 0 {
  54. return ""
  55. }
  56. return " built with: " + strings.Replace(Tags, " ", ", ", -1)
  57. }