cmd

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

Tea is command line tool for Gitea.

Index

Constants

This section is empty.

Variables

View Source
var CmdAddComment = cli.Command{
	Name:        "comment",
	Aliases:     []string{"c"},
	Category:    catEntities,
	Usage:       "Add a comment to an issue / pr",
	Description: "Add a comment to an issue / pr",
	ArgsUsage:   "<issue / pr index> [<comment body>]",
	Action:      runAddComment,
	Flags:       flags.AllDefaultFlags,
}

CmdAddComment is the main command to operate with notifications

View Source
var CmdAdmin = cli.Command{
	Name:     "admin",
	Usage:    "Operations requiring admin access on the Gitea instance",
	Aliases:  []string{"a"},
	Category: catMisc,
	Action: func(_ stdctx.Context, cmd *cli.Command) error {
		return cli.ShowSubcommandHelp(cmd)
	},
	Commands: []*cli.Command{
		&cmdAdminUsers,
	},
}

CmdAdmin represents the namespace of admin commands. The command itself has no functionality, but hosts subcommands.

View Source
var CmdAutocomplete = cli.Command{
	Name:        "shellcompletion",
	Aliases:     []string{"autocomplete"},
	Category:    catSetup,
	Usage:       "Install shell completion for tea",
	Description: "Install shell completion for tea",
	ArgsUsage:   "<shell type> (bash, zsh, powershell, fish)",
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:  "install",
			Usage: "Persist in shell config instead of printing commands",
		},
	},
	Action: runAutocompleteAdd,
}

CmdAutocomplete manages autocompletion

View Source
var CmdBranches = cli.Command{
	Name:        "branches",
	Aliases:     []string{"branch", "b"},
	Category:    catEntities,
	Usage:       "Consult branches",
	Description: `Lists branches when called without argument. If a branch is provided, will show it in detail.`,
	ArgsUsage:   "[<branch name>]",
	Action:      runBranches,
	Commands: []*cli.Command{
		&branches.CmdBranchesList,
		&branches.CmdBranchesProtect,
		&branches.CmdBranchesUnprotect,
	},
	Flags: append([]cli.Flag{
		&cli.BoolFlag{
			Name:  "comments",
			Usage: "Whether to display comments (will prompt if not provided & run interactively)",
		},
	}, branches.CmdBranchesList.Flags...),
}

CmdBranches represents to login a gitea server.

View Source
var CmdIssues = cli.Command{
	Name:        "issues",
	Aliases:     []string{"issue", "i"},
	Category:    catEntities,
	Usage:       "List, create and update issues",
	Description: `Lists issues when called without argument. If issue index is provided, will show it in detail.`,
	ArgsUsage:   "[<issue index>]",
	Action:      runIssues,
	Commands: []*cli.Command{
		&issues.CmdIssuesList,
		&issues.CmdIssuesCreate,
		&issues.CmdIssuesEdit,
		&issues.CmdIssuesReopen,
		&issues.CmdIssuesClose,
	},
	Flags: append([]cli.Flag{
		&cli.BoolFlag{
			Name:  "comments",
			Usage: "Whether to display comments (will prompt if not provided & run interactively)",
		},
	}, issues.CmdIssuesList.Flags...),
}

CmdIssues represents to login a gitea server.

View Source
var CmdLabels = cli.Command{
	Name:        "labels",
	Aliases:     []string{"label"},
	Category:    catEntities,
	Usage:       "Manage issue labels",
	Description: `Manage issue labels`,
	ArgsUsage:   " ",
	Action:      runLabels,
	Commands: []*cli.Command{
		&labels.CmdLabelsList,
		&labels.CmdLabelCreate,
		&labels.CmdLabelUpdate,
		&labels.CmdLabelDelete,
	},
	Flags: labels.CmdLabelsList.Flags,
}

CmdLabels represents to operate repositories' labels.

View Source
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>]",
	Action:      runLogins,
	Commands: []*cli.Command{
		&login.CmdLoginList,
		&login.CmdLoginAdd,
		&login.CmdLoginEdit,
		&login.CmdLoginDelete,
		&login.CmdLoginSetDefault,
		&login.CmdLoginHelper,
		&login.CmdLoginOAuthRefresh,
	},
}

CmdLogin represents to login a gitea server.

View Source
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>",
	Action:      login.RunLoginDelete,
}

CmdLogout represents to logout a gitea server.

View Source
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>]",
	Action:      runMilestones,
	Commands: []*cli.Command{
		&milestones.CmdMilestonesList,
		&milestones.CmdMilestonesCreate,
		&milestones.CmdMilestonesClose,
		&milestones.CmdMilestonesDelete,
		&milestones.CmdMilestonesReopen,
		&milestones.CmdMilestonesIssues,
	},
	Flags: milestones.CmdMilestonesList.Flags,
}

CmdMilestones represents to operate repositories milestones.

View Source
var CmdNotifications = cli.Command{
	Name:        "notifications",
	Aliases:     []string{"notification", "n"},
	Category:    catHelpers,
	Usage:       "Show notifications",
	Description: "Show notifications, by default based on the current repo if available",
	Action:      notifications.RunNotificationsList,
	Commands: []*cli.Command{
		&notifications.CmdNotificationsList,
		&notifications.CmdNotificationsMarkRead,
		&notifications.CmdNotificationsMarkUnread,
		&notifications.CmdNotificationsMarkPinned,
		&notifications.CmdNotificationsUnpin,
	},
	Flags: notifications.CmdNotificationsList.Flags,
}

CmdNotifications is the main command to operate with notifications

View Source
var CmdOpen = cli.Command{
	Name:        "open",
	Aliases:     []string{"o"},
	Category:    catHelpers,
	Usage:       "Open something of the repository in web browser",
	Description: `Open something of the repository in web browser`,
	Action:      runOpen,
	Flags:       append([]cli.Flag{}, flags.LoginRepoFlags...),
}

CmdOpen represents a sub command of issues to open issue on the web browser

View Source
var CmdOrgs = cli.Command{
	Name:        "organizations",
	Aliases:     []string{"organization", "org"},
	Category:    catEntities,
	Usage:       "List, create, delete organizations",
	Description: "Show organization details",
	ArgsUsage:   "[<organization>]",
	Action:      runOrganizations,
	Commands: []*cli.Command{
		&organizations.CmdOrganizationList,
		&organizations.CmdOrganizationCreate,
		&organizations.CmdOrganizationDelete,
	},
	Flags: organizations.CmdOrganizationList.Flags,
}

CmdOrgs represents handle organization

View Source
var CmdPulls = cli.Command{
	Name:        "pulls",
	Aliases:     []string{"pull", "pr"},
	Category:    catEntities,
	Usage:       "Manage and checkout pull requests",
	Description: `Lists PRs when called without argument. If PR index is provided, will show it in detail.`,
	ArgsUsage:   "[<pull index>]",
	Action:      runPulls,
	Flags: append([]cli.Flag{
		&cli.BoolFlag{
			Name:  "comments",
			Usage: "Whether to display comments (will prompt if not provided & run interactively)",
		},
	}, pulls.CmdPullsList.Flags...),
	Commands: []*cli.Command{
		&pulls.CmdPullsList,
		&pulls.CmdPullsCheckout,
		&pulls.CmdPullsClean,
		&pulls.CmdPullsCreate,
		&pulls.CmdPullsClose,
		&pulls.CmdPullsReopen,
		&pulls.CmdPullsReview,
		&pulls.CmdPullsApprove,
		&pulls.CmdPullsReject,
		&pulls.CmdPullsMerge,
	},
}

CmdPulls is the main command to operate on PRs

View Source
var CmdReleaseAttachments = cli.Command{
	Name:        "assets",
	Aliases:     []string{"asset", "a"},
	Category:    catEntities,
	Usage:       "Manage release assets",
	Description: "Manage release assets",
	ArgsUsage:   " ",
	Action:      attachments.RunReleaseAttachmentList,
	Commands: []*cli.Command{
		&attachments.CmdReleaseAttachmentList,
		&attachments.CmdReleaseAttachmentCreate,
		&attachments.CmdReleaseAttachmentDelete,
	},
	Flags: flags.AllDefaultFlags,
}

CmdReleaseAttachments represents a release attachment (file attachment)

View Source
var CmdReleases = cli.Command{
	Name:        "releases",
	Aliases:     []string{"release", "r"},
	Category:    catEntities,
	Usage:       "Manage releases",
	Description: "Manage releases",
	ArgsUsage:   " ",
	Action:      releases.RunReleasesList,
	Commands: []*cli.Command{
		&releases.CmdReleaseList,
		&releases.CmdReleaseCreate,
		&releases.CmdReleaseDelete,
		&releases.CmdReleaseEdit,
		&CmdReleaseAttachments,
	},
	Flags: flags.AllDefaultFlags,
}

CmdReleases represents to login a gitea server. ToDo: ReleaseDetails

View Source
var CmdRepoClone = cli.Command{
	Name:    "clone",
	Aliases: []string{"C"},
	Usage:   "Clone a repository locally",
	Description: `Clone a repository locally, without a local git installation required.
The repo slug can be specified in different formats:
	gitea/tea
	tea
	gitea.com/gitea/tea
	git@gitea.com:gitea/tea
	https://gitea.com/gitea/tea
	ssh://gitea.com:22/gitea/tea
When a host is specified in the repo-slug, it will override the login specified with --login.
	`,
	Category:  catHelpers,
	Action:    runRepoClone,
	ArgsUsage: "<repo-slug> [target dir]",
	Flags: []cli.Flag{
		&cli.IntFlag{
			Name:    "depth",
			Aliases: []string{"d"},
			Usage:   "num commits to fetch, defaults to all",
		},
		&flags.LoginFlag,
	},
}

CmdRepoClone represents a sub command of repos to create a local copy

View Source
var CmdRepos = cli.Command{
	Name:        "repos",
	Aliases:     []string{"repo"},
	Category:    catEntities,
	Usage:       "Show repository details",
	Description: "Show repository details",
	ArgsUsage:   "[<repo owner>/<repo name>]",
	Action:      runRepos,
	Commands: []*cli.Command{
		&repos.CmdReposList,
		&repos.CmdReposSearch,
		&repos.CmdRepoCreate,
		&repos.CmdRepoCreateFromTemplate,
		&repos.CmdRepoFork,
		&repos.CmdRepoMigrate,
		&repos.CmdRepoRm,
	},
	Flags: repos.CmdReposListFlags,
}

CmdRepos represents to login a gitea server.

View Source
var CmdTrackedTimes = cli.Command{
	Name:     "times",
	Aliases:  []string{"time", "t"},
	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.`,
	ArgsUsage: "[username | #issue]",
	Action:    times.RunTimesList,
	Commands: []*cli.Command{
		&times.CmdTrackedTimesAdd,
		&times.CmdTrackedTimesDelete,
		&times.CmdTrackedTimesReset,
		&times.CmdTrackedTimesList,
	},
	Flags: times.CmdTrackedTimesList.Flags,
}

CmdTrackedTimes represents the command to operate repositories' times.

View Source
var CmdWhoami = cli.Command{
	Name:        "whoami",
	Category:    catMisc,
	Description: `For debugging purposes, show the user that is currently logged in.`,
	Usage:       "Show current logged in user",
	ArgsUsage:   " ",
	Action: func(_ stdctx.Context, cmd *cli.Command) error {
		ctx := context.InitCommand(cmd)
		client := ctx.Login.Client()
		user, _, _ := client.GetMyUserInfo()
		print.UserDetails(user)
		return nil
	},
}

CmdWhoami represents the command to show current logged in user

View Source
var SDK = ""

SDK holds the sdk version from go.mod

View Source
var Tags = ""

Tags holds the build tags used

View Source
var Version = "development"

Version holds the current tea version

Functions

func App added in v0.10.0

func App() *cli.Command

App creates and returns a tea Command with all subcommands set it was separated from main so docs can be generated for it

Types

This section is empty.

Directories

Path Synopsis
admin

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL