make issues & pulls subcommands consistent (#188)

Merge branch 'master' into pr-details

make issues & pulls subcommands consistent

- by default list open items
- show detail when argument is provided
- expose listing as ls subcommand
- accept --state flag on command and ls subcommand

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Norwin Roosen <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/188
Reviewed-by: 6543 <6543@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Norwin
2020-09-21 05:03:20 +00:00
committed by Lunny Xiao
parent 89e93d90b3
commit d7f429d246
3 changed files with 55 additions and 15 deletions

View File

@@ -53,6 +53,13 @@ var OutputFlag = cli.StringFlag{
Destination: &outputValue,
}
// StateFlag provides flag to specify issue/pr state, defaulting to "open"
var StateFlag = cli.StringFlag{
Name: "state",
Usage: "Filter by state (all|open|closed)",
DefaultText: "open",
}
// 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:
@@ -81,6 +88,11 @@ var AllDefaultFlags = append([]cli.Flag{
&RemoteFlag,
}, LoginOutputFlags...)
// IssuePRFlags defines flags that should be available on issue & pr listing flags.
var IssuePRFlags = append([]cli.Flag{
&StateFlag,
}, AllDefaultFlags...)
// initCommand returns repository and *Login based on flags
func initCommand() (*Login, string, string) {
var login *Login