feat: logins list/default, actions run delete, date filters, label update alias
- fgj logins {list,default}: complementary UI to 'fgj auth'. 'list'
shows all configured hosts (hostname, user, protocol, default flag,
match_dirs) with --json. 'default [hostname]' gets or sets which
host wins in resolution when no other signal is present.
Adds 'Default bool' field to HostConfig; GetHost consults it between
match_dirs and the codeberg.org fallback. Multiple defaults tolerated
with a stderr warning; alphabetical-first wins.
- fgj actions run delete: delete a completed workflow run via raw
DELETE (SDK v0.23.2 has no DeleteRepoActionRun). Fetches run first
and refuses to delete non-terminal states unless --force; suggests
'actions run cancel' for those. Confirmation prompt unless --yes.
- pr list / issue list gain --since and --before date filter flags.
Accepts YYYY-MM-DD, RFC 3339, YYYY-MM-DD HH:MM:SS, and relative
deltas (7d, 24h, 2w, 1m — months=30 days). Issues use server-side
filter via ListIssueOption.Since/Before; PRs fall back to client-side
(SDK lacks Since/Before on ListPullRequestsOptions).
- fgj label update added as alias for 'fgj label edit' (tea-compat).
All changes:
cmd/logins.go (new, 140 LOC)
cmd/actions_run_delete.go (new, ~85 LOC)
cmd/pr.go, cmd/issue.go (+parseDateArg helper, filter wiring)
cmd/label.go (1-line alias)
internal/config/config.go (Default field + DefaultHost method)
CHANGELOG.md
Built in parallel by three sub-agents; plus the label alias done
serially. go build / go vet / go test -race all clean.
This commit is contained in:
parent
d15deaf064
commit
2d69873f3e
7 changed files with 462 additions and 7 deletions
31
cmd/issue.go
31
cmd/issue.go
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"forgejo.zerova.net/public/fgj-sid/internal/api"
|
||||
|
|
@ -29,7 +30,13 @@ var issueListCmd = &cobra.Command{
|
|||
fgj issue list -s closed -R owner/repo
|
||||
|
||||
# Output as JSON
|
||||
fgj issue list --json`,
|
||||
fgj issue list --json
|
||||
|
||||
# PRs updated in the last 7 days
|
||||
fgj pr list --since 7d
|
||||
|
||||
# Issues touched between two dates
|
||||
fgj issue list --since 2026-04-01 --before 2026-04-15`,
|
||||
RunE: runIssueList,
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +159,8 @@ func init() {
|
|||
issueListCmd.Flags().String("author", "", "Filter by author username")
|
||||
issueListCmd.Flags().StringSliceP("label", "l", nil, "Filter by label names")
|
||||
issueListCmd.Flags().StringP("search", "S", "", "Search keyword filter")
|
||||
issueListCmd.Flags().String("since", "", "Only items updated at or after this date (YYYY-MM-DD, RFC 3339, or relative like 7d)")
|
||||
issueListCmd.Flags().String("before", "", "Only items updated strictly before this date (YYYY-MM-DD, RFC 3339, or relative like 1d)")
|
||||
addJSONFlags(issueListCmd, "Output issues as JSON")
|
||||
|
||||
issueViewCmd.Flags().StringP("repo", "R", "", "Repository in owner/name format")
|
||||
|
|
@ -192,6 +201,24 @@ func runIssueList(cmd *cobra.Command, args []string) error {
|
|||
author, _ := cmd.Flags().GetString("author")
|
||||
labels, _ := cmd.Flags().GetStringSlice("label")
|
||||
search, _ := cmd.Flags().GetString("search")
|
||||
sinceStr, _ := cmd.Flags().GetString("since")
|
||||
beforeStr, _ := cmd.Flags().GetString("before")
|
||||
|
||||
var sinceTime, beforeTime time.Time
|
||||
if sinceStr != "" {
|
||||
t, err := parseDateArg(sinceStr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid --since: %w", err)
|
||||
}
|
||||
sinceTime = t
|
||||
}
|
||||
if beforeStr != "" {
|
||||
t, err := parseDateArg(beforeStr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid --before: %w", err)
|
||||
}
|
||||
beforeTime = t
|
||||
}
|
||||
|
||||
owner, name, err := parseRepo(repo)
|
||||
if err != nil {
|
||||
|
|
@ -227,6 +254,8 @@ func runIssueList(cmd *cobra.Command, args []string) error {
|
|||
KeyWord: search,
|
||||
CreatedBy: author,
|
||||
AssignedBy: assignee,
|
||||
Since: sinceTime,
|
||||
Before: beforeTime,
|
||||
ListOptions: gitea.ListOptions{PageSize: limit},
|
||||
})
|
||||
ios.StopSpinner()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue