2018-09-03 02:43:00 -04:00
|
|
|
// Copyright 2018 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Tea is command line tool for Gitea.
|
|
|
|
package main // import "code.gitea.io/tea"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"code.gitea.io/tea/cmd"
|
|
|
|
"code.gitea.io/tea/modules/setting"
|
|
|
|
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Version holds the current Gitea version
|
|
|
|
var Version = "0.1.0-dev"
|
|
|
|
|
|
|
|
// Tags holds the build tags used
|
|
|
|
var Tags = ""
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
setting.AppVer = Version
|
|
|
|
setting.AppBuiltWith = formatBuiltWith(Tags)
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := cli.NewApp()
|
|
|
|
app.Name = "Tea"
|
2019-03-11 12:32:09 -04:00
|
|
|
app.Usage = "Command line tool to interact with Gitea"
|
2018-09-03 02:43:00 -04:00
|
|
|
app.Description = ``
|
|
|
|
app.Version = Version + formatBuiltWith(Tags)
|
|
|
|
app.Commands = []cli.Command{
|
|
|
|
cmd.CmdLogin,
|
|
|
|
cmd.CmdLogout,
|
|
|
|
cmd.CmdIssues,
|
|
|
|
cmd.CmdPulls,
|
|
|
|
cmd.CmdReleases,
|
2019-11-07 20:33:46 -05:00
|
|
|
cmd.CmdRepos,
|
2019-10-19 06:54:16 -04:00
|
|
|
cmd.CmdLabels,
|
2018-09-03 02:43:00 -04:00
|
|
|
}
|
2019-08-13 06:59:13 -04:00
|
|
|
app.EnableBashCompletion = true
|
2018-09-03 02:43:00 -04:00
|
|
|
err := app.Run(os.Args)
|
|
|
|
if err != nil {
|
2019-10-26 00:50:30 -04:00
|
|
|
log.Fatalf("Failed to run app with %s: %v", os.Args, err)
|
2018-09-03 02:43:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func formatBuiltWith(Tags string) string {
|
|
|
|
if len(Tags) == 0 {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
return " built with: " + strings.Replace(Tags, " ", ", ", -1)
|
|
|
|
}
|