Proper help text & new README structure #311

Merged
lunny merged 11 commits from noerw/tea:improve-app-help into master 2020-12-21 13:37:21 +00:00
14 changed files with 32 additions and 7 deletions
Showing only changes of commit 1513d64a30 - Show all commits

11
cmd/categories.go Normal file
View File

@ -0,0 +1,11 @@
// Copyright 2020 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.
package cmd
var (
catSetup = "SETUP"
catEntities = "ENTITIES"
catHelpers = "HELPERS"
)

View File

@ -18,6 +18,7 @@ import (
var CmdIssues = cli.Command{
Name: "issues",
Aliases: []string{"issue"},
Category: catEntities,
Usage: "List, create and update issues",
Description: "List, create and update issues",
ArgsUsage: "[<issue index>]",

View File

@ -15,6 +15,7 @@ import (
var CmdLabels = cli.Command{
Name: "labels",
Aliases: []string{"label"},
Category: catEntities,
Usage: "Manage issue labels",
Description: `Manage issue labels`,
Action: runLabels,

View File

@ -18,6 +18,7 @@ import (
var CmdLogin = cli.Command{
Name: "logins",
Aliases: []string{"login"},
Category: catSetup,
Usage: "Log in to a Gitea server",
Description: `Log in to a Gitea server`,
ArgsUsage: "[<login name>]",

View File

@ -13,6 +13,7 @@ import (
// CmdLogout represents to logout a gitea server.
var CmdLogout = cli.Command{
Name: "logout",
Category: catSetup,
Usage: "Log out from a Gitea server",
Description: `Log out from a Gitea server`,
ArgsUsage: "<login name>",

View File

@ -17,6 +17,7 @@ import (
var CmdMilestones = cli.Command{
Name: "milestones",
Aliases: []string{"milestone", "ms"},
Category: catEntities,
Usage: "List and create milestones",
Description: `List and create milestones`,
ArgsUsage: "[<milestone name>]",

View File

@ -19,6 +19,7 @@ import (
var CmdNotifications = cli.Command{
Name: "notifications",
Aliases: []string{"notification", "notif"},
Category: catHelpers,
Usage: "Show notifications",
Description: "Show notifications, by default based of the current repo and unread one",
Action: runNotifications,

View File

@ -20,6 +20,7 @@ import (
// CmdOpen represents a sub command of issues to open issue on the web browser
var CmdOpen = cli.Command{
Name: "open",
Category: catHelpers,
Usage: "Open something of the repository on web browser",
Description: `Open something of the repository on web browser`,
Action: runOpen,

View File

@ -16,6 +16,7 @@ import (
var CmdOrgs = cli.Command{
Name: "organizations",
Aliases: []string{"organization", "org"},
Category: catEntities,
Usage: "List, create, delete organizations",
Description: "Show organization details",
ArgsUsage: "[<organization>]",

View File

@ -21,6 +21,7 @@ import (
var CmdPulls = cli.Command{
Name: "pulls",
Aliases: []string{"pull", "pr"},
Category: catEntities,
Usage: "List, create, checkout and clean pull requests",
Description: `List, create, checkout and clean pull requests`,
ArgsUsage: "[<pull index>]",

View File

@ -16,6 +16,7 @@ import (
var CmdReleases = cli.Command{
Name: "releases",
Aliases: []string{"release"},
Category: catEntities,
Usage: "Manage releases",
Description: "Manage releases",
Action: releases.RunReleasesList,

View File

@ -18,6 +18,7 @@ import (
var CmdRepos = cli.Command{
Name: "repos",
Aliases: []string{"repo"},
Category: catEntities,
Usage: "Show repository details",
Description: "Show repository details",
ArgsUsage: "[<repo owner>/<repo name>]",

View File

@ -11,9 +11,10 @@ import (
// CmdTrackedTimes represents the command to operate repositories' times.
var CmdTrackedTimes = cli.Command{
Name: "times",
Aliases: []string{"time"},
Usage: "Operate on tracked times of a repository's issues & pulls",
Name: "times",
Aliases: []string{"time"},
Category: catEntities,
Usage: "Operate on tracked times of a repository's issues & pulls",
Description: `Operate on tracked times of a repository's issues & pulls.
Depending on your permissions on the repository, only your own tracked
times might be listed.`,

10
main.go
View File

@ -35,16 +35,18 @@ func main() {
app.Commands = []*cli.Command{
&cmd.CmdLogin,
&cmd.CmdLogout,
&cmd.CmdIssues,
&cmd.CmdPulls,
&cmd.CmdReleases,
&cmd.CmdRepos,
&cmd.CmdLabels,
&cmd.CmdMilestones,
&cmd.CmdReleases,
&cmd.CmdTrackedTimes,
&cmd.CmdOrgs,
&cmd.CmdRepos,
&cmd.CmdOpen,
&cmd.CmdNotifications,
&cmd.CmdMilestones,
&cmd.CmdOrgs,
}
app.EnableBashCompletion = true
err := app.Run(os.Args)