A command line tool to interact with Gitea servers
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.

59 lines
1.2KB

  1. // Copyright 2018 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. // Tea is command line tool for Gitea.
  5. package main // import "code.gitea.io/tea"
  6. import (
  7. "log"
  8. "os"
  9. "strings"
  10. "code.gitea.io/tea/cmd"
  11. "code.gitea.io/tea/modules/setting"
  12. "github.com/urfave/cli"
  13. )
  14. // Version holds the current Gitea version
  15. var Version = "0.1.0-dev"
  16. // Tags holds the build tags used
  17. var Tags = ""
  18. func init() {
  19. setting.AppVer = Version
  20. setting.AppBuiltWith = formatBuiltWith(Tags)
  21. }
  22. func main() {
  23. app := cli.NewApp()
  24. app.Name = "Tea"
  25. app.Usage = "Command line tool to interact with Gitea"
  26. app.Description = ``
  27. app.Version = Version + formatBuiltWith(Tags)
  28. app.Commands = []cli.Command{
  29. cmd.CmdLogin,
  30. cmd.CmdLogout,
  31. cmd.CmdIssues,
  32. cmd.CmdPulls,
  33. cmd.CmdReleases,
  34. cmd.CmdRepos,
  35. cmd.CmdLabels,
  36. }
  37. app.EnableBashCompletion = true
  38. err := app.Run(os.Args)
  39. if err != nil {
  40. log.Fatalf("Failed to run app with %s: %v", os.Args, err)
  41. }
  42. }
  43. func formatBuiltWith(Tags string) string {
  44. if len(Tags) == 0 {
  45. return ""
  46. }
  47. return " built with: " + strings.Replace(Tags, " ", ", ", -1)
  48. }