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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. "github.com/urfave/cli"
  14. )
  15. // Version holds the current Gitea version
  16. var Version = "1.1.0+dev"
  17. // Tags holds the build tags used
  18. var Tags = ""
  19. func init() {
  20. setting.AppVer = Version
  21. setting.AppBuiltWith = formatBuiltWith(Tags)
  22. }
  23. func main() {
  24. app := cli.NewApp()
  25. app.Name = "Gitea"
  26. app.Usage = "A painless self-hosted Git service"
  27. app.Version = Version + formatBuiltWith(Tags)
  28. app.Commands = []cli.Command{
  29. cmd.CmdWeb,
  30. cmd.CmdServ,
  31. cmd.CmdHook,
  32. cmd.CmdDump,
  33. cmd.CmdCert,
  34. cmd.CmdAdmin,
  35. }
  36. app.Flags = append(app.Flags, []cli.Flag{}...)
  37. err := app.Run(os.Args)
  38. if err != nil {
  39. log.Fatal(4, "Failed to run app with %s: %v", os.Args, err)
  40. }
  41. }
  42. func formatBuiltWith(Tags string) string {
  43. if len(Tags) == 0 {
  44. return ""
  45. }
  46. return " built with: " + strings.Replace(Tags, " ", ", ", -1)
  47. }