fix(notification): word --all confirmations and flag values clearly

notification mark-read --all asked "Marked as read all … ?"; each command now asks in its own words, such as "Pin all unread notifications in your inbox?". The status and type filters list their values in help, the api parameter flags read like gh's, and tea auth login --help aligns its method list.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 23:50:47 +02:00
1 parent 9e74ec54ad
commit 390e8e04f6
4 files changed
+22 -16

No files matched your search

+9 -9
View File
@@ -48,12 +48,12 @@ list shows identify notification threads; they are not issue numbers.`}
}
group.AddCommand(a.notificationListCommand(scope), a.notificationWatchCommand(scope), a.notificationViewCommand(scope))
for _, mark := range []struct {
verb, status, filter, short, done, example string
verb, status, filter, short, ask, done, example string
}{
{"mark-read", "read", "unread", "Mark notifications as read", "Marked %s as read", "$ tea notification mark-read 28\n# Everything in one repository\n$ tea notification mark-read --all -R alice/project"},
{"mark-unread", "unread", "read", "Mark notifications as unread", "Marked %s as unread", "$ tea notification mark-unread 28 26"},
{"pin", "pinned", "unread", "Pin notifications", "Pinned %s", "$ tea notification pin 28"},
{"unpin", "read", "pinned", "Unpin notifications", "Unpinned %s", "$ tea notification unpin 28\n# Unpin everything\n$ tea notification unpin --all"},
{"mark-read", "read", "unread", "Mark notifications as read", "Mark all %s as read?", "Marked %s as read", "$ tea notification mark-read 28\n# Everything in one repository\n$ tea notification mark-read --all -R alice/project"},
{"mark-unread", "unread", "read", "Mark notifications as unread", "Mark all %s as unread?", "Marked %s as unread", "$ tea notification mark-unread 28 26"},
{"pin", "pinned", "unread", "Pin notifications", "Pin all %s?", "Pinned %s", "$ tea notification pin 28"},
{"unpin", "read", "pinned", "Unpin notifications", "Unpin all %s?", "Unpinned %s", "$ tea notification unpin 28\n# Unpin everything\n$ tea notification unpin --all"},
} {
var all bool
var filters []string
@@ -100,7 +100,7 @@ list shows identify notification threads; they are not issue numbers.`}
}
what := notificationsWith(filters) + " " + s.where
if settings, err := a.deps.Settings.Load(); err == nil && a.policy(settings).CanPrompt(a.deps.Streams) {
if err := a.confirmAction(cmd, terminal.Confirmation{Prompt: fmt.Sprintf("%s all %s?", strings.Replace(mark.done, " %s", "", 1), what), DefaultYes: true}); err != nil {
if err := a.confirmAction(cmd, terminal.Confirmation{Prompt: fmt.Sprintf(mark.ask, what), DefaultYes: true}); err != nil {
return err
}
}
@@ -120,7 +120,7 @@ list shows identify notification threads; they are not issue numbers.`}
},
}
command.Flags().BoolVar(&all, "all", false, "Apply to every notification that matches --status in the scope")
command.Flags().StringSliceVar(&filters, "status", nil, "With --all, the statuses to change")
command.Flags().StringSliceVar(&filters, "status", nil, "With --all, the statuses to change: unread, read, pinned")
enumValues(command, "status", "unread", "read", "pinned")
command.Flags().StringVar(&before, "before", "", "With --all, only notifications updated before a date, timestamp, or duration such as 1h")
group.AddCommand(command)
@@ -131,9 +131,9 @@ list shows identify notification threads; they are not issue numbers.`}
// notificationFilters registers the list filters of list and watch.
func notificationFilters(cmd *cobra.Command, opts *services.NotificationOptions, updated *timeRange) {
pageFlags(cmd, &opts.Limit, &opts.Page)
cmd.Flags().StringSliceVar(&opts.Statuses, "status", []string{"unread", "pinned"}, "Only notifications with these statuses")
cmd.Flags().StringSliceVar(&opts.Statuses, "status", []string{"unread", "pinned"}, "Only notifications with these statuses: unread, read, pinned")
enumValues(cmd, "status", "unread", "read", "pinned")
cmd.Flags().StringSliceVar(&opts.Types, "type", nil, "Only notifications about these subjects")
cmd.Flags().StringSliceVar(&opts.Types, "type", nil, "Only notifications about these subjects: issue, pull, commit, repository")
enumValues(cmd, "type", "issue", "pull", "commit", "repository")
updated.register(cmd, "since", "Only notifications updated since a date, timestamp, or duration such as 24h", "before", "Only notifications updated before a date, timestamp, or duration such as 1h")
}