2018-09-03 08:43:00 +02: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"
|
|
|
|
|
2020-01-04 18:44:25 +01:00
|
|
|
"github.com/urfave/cli/v2"
|
2018-09-03 08:43:00 +02:00
|
|
|
)
|
|
|
|
|
2020-04-22 21:11:03 +02:00
|
|
|
// Version holds the current tea version
|
|
|
|
var Version = "development"
|
2018-09-03 08:43:00 +02:00
|
|
|
|
|
|
|
// Tags holds the build tags used
|
|
|
|
var Tags = ""
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
app := cli.NewApp()
|
2020-03-06 04:43:28 +01:00
|
|
|
app.Name = "tea"
|
2019-03-11 17:32:09 +01:00
|
|
|
app.Usage = "Command line tool to interact with Gitea"
|
2018-09-03 08:43:00 +02:00
|
|
|
app.Description = ``
|
|
|
|
app.Version = Version + formatBuiltWith(Tags)
|
2020-01-04 18:44:25 +01:00
|
|
|
app.Commands = []*cli.Command{
|
|
|
|
&cmd.CmdLogin,
|
|
|
|
&cmd.CmdLogout,
|
|
|
|
&cmd.CmdIssues,
|
|
|
|
&cmd.CmdPulls,
|
|
|
|
&cmd.CmdReleases,
|
|
|
|
&cmd.CmdRepos,
|
|
|
|
&cmd.CmdLabels,
|
2020-03-06 04:43:28 +01:00
|
|
|
&cmd.CmdTrackedTimes,
|
2020-04-01 05:22:24 +02:00
|
|
|
&cmd.CmdOpen,
|
2020-07-17 17:30:02 +02:00
|
|
|
&cmd.CmdNotifications,
|
2020-09-17 21:35:24 +02:00
|
|
|
&cmd.CmdMilestones,
|
2020-12-06 23:02:50 +01:00
|
|
|
&cmd.CmdOrgs,
|
2020-12-16 17:01:59 +01:00
|
|
|
&cmd.CmdAutocomplete,
|
2018-09-03 08:43:00 +02:00
|
|
|
}
|
2019-08-13 12:59:13 +02:00
|
|
|
app.EnableBashCompletion = true
|
2018-09-03 08:43:00 +02:00
|
|
|
err := app.Run(os.Args)
|
|
|
|
if err != nil {
|
2019-10-26 06:50:30 +02:00
|
|
|
log.Fatalf("Failed to run app with %s: %v", os.Args, err)
|
2018-09-03 08:43:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func formatBuiltWith(Tags string) string {
|
|
|
|
if len(Tags) == 0 {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
return " built with: " + strings.Replace(Tags, " ", ", ", -1)
|
|
|
|
}
|