Files
Atay-Makhzan/main.go
T

61 lines
1.5 KiB
Go
Raw Normal View History

2014-02-19 13:04:31 -05:00
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2016 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
2014-02-19 17:50:53 +08:00
2023-07-21 17:28:19 +08:00
package main
2014-02-12 12:49:46 -05:00
import (
2014-02-19 17:50:53 +08:00
"os"
2019-01-24 16:22:51 +01:00
"runtime"
2017-02-28 01:40:02 +01:00
"strings"
"time"
2016-12-01 00:56:15 +01:00
"code.gitea.io/gitea/cmd"
2017-01-04 21:16:03 +08:00
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
2018-11-01 13:41:07 +00:00
// register supported doc types
_ "code.gitea.io/gitea/modules/markup/asciicast"
_ "code.gitea.io/gitea/modules/markup/console"
_ "code.gitea.io/gitea/modules/markup/csv"
_ "code.gitea.io/gitea/modules/markup/markdown"
_ "code.gitea.io/gitea/modules/markup/orgmode"
"github.com/urfave/cli/v2"
2014-02-12 12:49:46 -05:00
)
2023-07-21 17:28:19 +08:00
// these flags will be set by the build flags
2019-04-03 00:10:11 +08:00
var (
2023-07-21 17:28:19 +08:00
Version = "development" // program version for this build
Tags = "" // the Golang build tags
MakeVersion = "" // "make" program version if built with make
2019-04-03 00:10:11 +08:00
)
2017-02-28 01:40:02 +01:00
2014-02-12 14:54:09 -05:00
func init() {
2016-11-04 12:32:04 +01:00
setting.AppVer = Version
2019-06-12 21:41:28 +02:00
setting.AppBuiltWith = formatBuiltWith()
setting.AppStartTime = time.Now().UTC()
2023-06-21 13:50:26 +08:00
}
2014-02-12 12:49:46 -05:00
func main() {
cli.OsExiter = func(code int) {
log.GetManager().Close()
os.Exit(code)
2016-12-01 00:56:15 +01:00
}
app := cmd.NewMainApp(Version, formatBuiltWith())
_ = cmd.RunMainApp(app, os.Args...) // all errors should have been handled by the RunMainApp
2023-05-22 06:35:11 +08:00
log.GetManager().Close()
2014-02-12 12:49:46 -05:00
}
2017-02-28 01:40:02 +01:00
2019-06-12 21:41:28 +02:00
func formatBuiltWith() string {
2022-01-20 18:46:10 +01:00
version := runtime.Version()
2019-04-03 00:10:11 +08:00
if len(MakeVersion) > 0 {
version = MakeVersion + ", " + runtime.Version()
}
2017-02-28 01:40:02 +01:00
if len(Tags) == 0 {
2019-04-03 00:10:11 +08:00
return " built with " + version
2017-02-28 01:40:02 +01:00
}
return " built with " + version + " : " + strings.ReplaceAll(Tags, " ", ", ")
2017-02-28 01:40:02 +01:00
}