mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 18:08:30 +02:00
Implement notification subcommands (#389)
- [x] enhance notification listing - add `--states` and `--type` filters - toggle per-user or per-repo listing via `--mine` flag - print more fields - [x] add subcommands to mark notifications as read, unread, pinned, unpinned. operates on - all notifications matching the `--state` and `--mine` filter flags, or - a notification specified by ID. - [ ] ~~add a `--fields` flag for notifications listing.~~ *not in this PR* - [ ] ~~interactive mode~~ *not in this PR*. this would go well together with #324 fixes #243, fixes #155 based on initial work in #283 and #386, but opening a new PR for @6543 to review as I changed quite a lot --- ### ⚠️ breaking ⚠️ - `tea notifications --all` has moved to `tea notifications --mine` - `tea notifications` now only works with the context of a remote repo. To run this outside of a local git dir, run either `tea n --mine` or `tea n --repo <my/repo>` --- Co-authored-by: Karl Heinz Marbaise <kama@soebes.de> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Norwin Roosen <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/389 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Alexey 〒erentyev <axifive@noreply.gitea.io> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -13,6 +13,10 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var repoFieldsFlag = flags.FieldsFlag(print.RepoFields, []string{
|
||||
"owner", "name", "type", "ssh",
|
||||
})
|
||||
|
||||
// CmdReposListFlags contains all flags needed for repo listing
|
||||
var CmdReposListFlags = append([]cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
@ -27,9 +31,7 @@ var CmdReposListFlags = append([]cli.Flag{
|
||||
Required: false,
|
||||
Usage: "List your starred repos instead",
|
||||
},
|
||||
flags.FieldsFlag(print.RepoFields, []string{
|
||||
"owner", "name", "type", "ssh",
|
||||
}),
|
||||
repoFieldsFlag,
|
||||
&typeFilterFlag,
|
||||
&flags.PaginationPageFlag,
|
||||
&flags.PaginationLimitFlag,
|
||||
@ -82,7 +84,7 @@ func RunReposList(cmd *cli.Context) error {
|
||||
reposFiltered = filterReposByType(rps, typeFilter)
|
||||
}
|
||||
|
||||
fields, err := flags.GetFields(cmd, print.RepoFields)
|
||||
fields, err := repoFieldsFlag.GetValues(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -50,9 +50,7 @@ var CmdReposSearch = cli.Command{
|
||||
Required: false,
|
||||
Usage: "Filter archived repos (true|false)",
|
||||
},
|
||||
flags.FieldsFlag(print.RepoFields, []string{
|
||||
"owner", "name", "type", "ssh",
|
||||
}),
|
||||
repoFieldsFlag,
|
||||
&flags.PaginationPageFlag,
|
||||
&flags.PaginationLimitFlag,
|
||||
}, flags.LoginOutputFlags...),
|
||||
@ -125,7 +123,7 @@ func runReposSearch(cmd *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
fields, err := flags.GetFields(cmd, nil)
|
||||
fields, err := repoFieldsFlag.GetValues(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user