cmd

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllDefaultFlags = append([]cli.Flag{
	RepoFlag,
	RemoteFlag,
}, LoginOutputFlags...)

AllDefaultFlags defines flags that should be available for all subcommands working with dedicated repositories to work around issue and provide --login, --repo and --output: https://github.com/urfave/cli/issues/585

View Source
var CmdIssues = cli.Command{
	Name:        "issues",
	Usage:       "List and create issues",
	Description: `List and create issues`,
	Action:      runIssues,
	Subcommands: []cli.Command{
		CmdIssuesList,
		CmdIssuesCreate,
	},
	Flags: AllDefaultFlags,
}

CmdIssues represents to login a gitea server.

View Source
var CmdIssuesCreate = cli.Command{
	Name:        "create",
	Usage:       "Create an issue on repository",
	Description: `Create an issue on repository`,
	Action:      runIssuesCreate,
	Flags: append([]cli.Flag{
		cli.StringFlag{
			Name:  "title, t",
			Usage: "issue title to create",
		},
		cli.StringFlag{
			Name:  "body, b",
			Usage: "issue body to create",
		},
	}, LoginRepoFlags...),
}

CmdIssuesCreate represents a sub command of issues to create issue

View Source
var CmdIssuesList = cli.Command{
	Name:        "ls",
	Usage:       "List issues of the repository",
	Description: `List issues of the repository`,
	Action:      runIssuesList,
	Flags:       AllDefaultFlags,
}

CmdIssuesList represents a sub command of issues to list issues

View Source
var CmdLabelCreate = cli.Command{
	Name:        "create",
	Usage:       "Create a label",
	Description: `Create a label`,
	Action:      runLabelCreate,
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "name",
			Usage: "label name",
		},
		cli.StringFlag{
			Name:  "color",
			Usage: "label color value",
		},
		cli.StringFlag{
			Name:  "description",
			Usage: "label description",
		},
		cli.StringFlag{
			Name:  "file",
			Usage: "indicate a label file",
		},
	},
}

CmdLabelCreate represents a sub command of labels to create label.

View Source
var CmdLabelDelete = cli.Command{
	Name:        "delete",
	Usage:       "Delete a label",
	Description: `Delete a label`,
	Action:      runLabelCreate,
	Flags: []cli.Flag{
		cli.IntFlag{
			Name:  "id",
			Usage: "label id",
		},
	},
}

CmdLabelDelete represents a sub command of labels to delete label.

View Source
var CmdLabelUpdate = cli.Command{
	Name:        "update",
	Usage:       "Update a label",
	Description: `Update a label`,
	Action:      runLabelUpdate,
	Flags: []cli.Flag{
		cli.IntFlag{
			Name:  "id",
			Usage: "label id",
		},
		cli.StringFlag{
			Name:  "name",
			Usage: "label name",
		},
		cli.StringFlag{
			Name:  "color",
			Usage: "label color value",
		},
		cli.StringFlag{
			Name:  "description",
			Usage: "label description",
		},
	},
}

CmdLabelUpdate represents a sub command of labels to update label.

View Source
var CmdLabels = cli.Command{
	Name:        "labels",
	Usage:       "Manage issue labels",
	Description: `Manage issue labels`,
	Action:      runLabels,
	Subcommands: []cli.Command{
		CmdLabelCreate,
		CmdLabelUpdate,
		CmdLabelDelete,
	},
	Flags: append([]cli.Flag{
		cli.StringFlag{
			Name:  "save, s",
			Usage: "Save all the labels as a file",
		},
	}, AllDefaultFlags...),
}

CmdLabels represents to operate repositories' labels.

View Source
var CmdLogin = cli.Command{
	Name:        "login",
	Usage:       "Log in to a Gitea server",
	Description: `Log in to a Gitea server`,
	Subcommands: []cli.Command{
		cmdLoginList,
		cmdLoginAdd,
	},
}

CmdLogin represents to login a gitea server.

View Source
var CmdLogout = cli.Command{
	Name:        "logout",
	Usage:       "Log out from a Gitea server",
	Description: `Log out from a Gitea server`,
	Action:      runLogout,
	Flags: []cli.Flag{
		cli.StringFlag{
			Name:  "name, n",
			Usage: "Login name to remove",
		},
	},
}

CmdLogout represents to logout a gitea server.

View Source
var CmdPulls = cli.Command{
	Name:        "pulls",
	Usage:       "List open pull requests",
	Description: `List open pull requests`,
	Action:      runPulls,
	Flags:       AllDefaultFlags,
}

CmdPulls represents to login a gitea server.

View Source
var CmdReleaseCreate = cli.Command{
	Name:        "create",
	Usage:       "Create a release",
	Description: `Create a release`,
	Action:      runReleaseCreate,
	Flags: append([]cli.Flag{
		cli.StringFlag{
			Name:  "tag",
			Usage: "Tag name",
		},
		cli.StringFlag{
			Name:  "target",
			Usage: "Target refs, branch name or commit id",
		},
		cli.StringFlag{
			Name:  "title, t",
			Usage: "Release title",
		},
		cli.StringFlag{
			Name:  "note, n",
			Usage: "Release notes",
		},
		cli.BoolFlag{
			Name:  "draft, d",
			Usage: "Is a draft",
		},
		cli.BoolFlag{
			Name:  "prerelease, p",
			Usage: "Is a pre-release",
		},
		cli.StringSliceFlag{
			Name:  "asset, a",
			Usage: "List of files to attach",
		},
	}, LoginRepoFlags...),
}

CmdReleaseCreate represents a sub command of Release to create release.

View Source
var CmdReleases = cli.Command{
	Name:        "releases",
	Usage:       "Create releases",
	Description: `Create releases`,
	Action:      runReleases,
	Subcommands: []cli.Command{
		CmdReleaseCreate,
	},
	Flags: AllDefaultFlags,
}

CmdReleases represents to login a gitea server.

View Source
var CmdRepos = cli.Command{
	Name:        "repos",
	Usage:       "Operate with repositories",
	Description: `Operate with repositories`,
	Action:      runReposList,
	Subcommands: []cli.Command{
		CmdReposList,
	},
	Flags: LoginOutputFlags,
}

CmdRepos represents to login a gitea server.

View Source
var CmdReposList = cli.Command{
	Name:        "ls",
	Usage:       "List available repositories",
	Description: `List available repositories`,
	Action:      runReposList,
	Flags: append([]cli.Flag{
		cli.StringFlag{
			Name:  "mode",
			Usage: "Filter listed repositories based on mode, optional - fork, mirror, source",
		},
		cli.StringFlag{
			Name:  "org",
			Usage: "Filter listed repositories based on organization, optional",
		},
		cli.StringFlag{
			Name:  "user",
			Usage: "Filter listed repositories absed on user, optional",
		},
	}, LoginOutputFlags...),
}

CmdReposList represents a sub command of issues to list issues

View Source
var LoginFlag = cli.StringFlag{
	Name:        "login, l",
	Usage:       "Use a different Gitea login. Optional",
	Destination: &loginValue,
}

LoginFlag provides flag to specify tea login profile

View Source
var LoginOutputFlags = []cli.Flag{
	LoginFlag,
	OutputFlag,
}

LoginOutputFlags defines login and output flags that should added to all subcommands and appended to the flags of the subcommand to work around issue and provide --login and --output: https://github.com/urfave/cli/issues/585

View Source
var LoginRepoFlags = []cli.Flag{
	LoginFlag,
	RepoFlag,
}

LoginRepoFlags defines login and repo flags that should be used for all subcommands and appended to the flags of the subcommand to work around issue and provide --login and --repo: https://github.com/urfave/cli/issues/585

View Source
var OutputFlag = cli.StringFlag{
	Name:        "output, o",
	Usage:       "Output format. (csv, simple, table, tsv, yaml)",
	Destination: &outputValue,
}

OutputFlag provides flag to specify output type

View Source
var RemoteFlag = cli.StringFlag{
	Name:        "remote, R",
	Usage:       "Discover Gitea login from remote. Optional",
	Destination: &remoteValue,
}

RemoteFlag provides flag to specify remote repository

View Source
var RepoFlag = cli.StringFlag{
	Name:        "repo, r",
	Usage:       "Repository to interact with. Optional",
	Destination: &repoValue,
}

RepoFlag provides flag to specify repository

Functions

func Error

func Error(a ...interface{})

Error println content as an error information

func Errorf

func Errorf(format string, a ...interface{})

Errorf printf content as an error information

func Output

func Output(output string, headers []string, values [][]string)

Output provides general function to convert given information into several outputs

func Printf

func Printf(format string, a ...interface{})

Printf printf content according the flag

func Println

func Println(a ...interface{})

Println println content according the flag

Types

type Config

type Config struct {
	Logins []Login `yaml:"logins"`
}

Config reprensents local configurations

type Login

type Login struct {
	Name     string `yaml:"name"`
	URL      string `yaml:"url"`
	Token    string `yaml:"token"`
	Active   bool   `yaml:"active"`
	SSHHost  string `yaml:"ssh_host"`
	Insecure bool   `yaml:"insecure"`
}

Login represents a login to a gitea server, you even could add multiple logins for one gitea server

func (*Login) Client

func (l *Login) Client() *gitea.Client

Client returns a client to operate Gitea API

func (*Login) GetSSHHost

func (l *Login) GetSSHHost() string

GetSSHHost returns SSH host name

Jump to

Keyboard shortcuts

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