Compare commits

...

2 Commits

Author SHA1 Message Date
Peter Steinberger
b6c09b834e fix: land PR #158 + restore contact helper compile flow (thanks @robnew)
Some checks failed
ci / test (push) Has been cancelled
ci / worker (push) Has been cancelled
ci / darwin-cgo-build (push) Has been cancelled
2026-02-16 05:48:29 +01:00
Rob Newberry
67fe654cfe Fix invalid Go version in go.mod 2026-02-16 05:45:28 +01:00
4 changed files with 16 additions and 14 deletions

View File

@ -8,6 +8,7 @@
- Contacts: support `--org`, `--title`, `--url`, `--note`, and `--custom` on create/update; include custom fields in get output with deterministic ordering. (#199) — thanks @phuctm97. - Contacts: support `--org`, `--title`, `--url`, `--note`, and `--custom` on create/update; include custom fields in get output with deterministic ordering. (#199) — thanks @phuctm97.
### Fixed ### Fixed
- Build: downgrade `go.mod` from `1.25` to `1.24` and align dependency declarations. (#158) — thanks @robnew.
- Calendar: respond patches only attendees to avoid custom reminders validation errors. (#265) — thanks @sebasrodriguez. - Calendar: respond patches only attendees to avoid custom reminders validation errors. (#265) — thanks @sebasrodriguez.
- Secrets: respect empty `GOG_KEYRING_PASSWORD` (treat set-to-empty as intentional; avoids headless prompts). (#269) — thanks @zerone0x. - Secrets: respect empty `GOG_KEYRING_PASSWORD` (treat set-to-empty as intentional; avoids headless prompts). (#269) — thanks @zerone0x.

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/steipete/gogcli module github.com/steipete/gogcli
go 1.25 go 1.24.0
require ( require (
github.com/99designs/keyring v1.2.2 github.com/99designs/keyring v1.2.2

View File

@ -166,11 +166,12 @@ func (c *ContactsGetCmd) Run(ctx context.Context, flags *RootFlags) error {
u.Out().Printf("birthday\t%s", bd) u.Out().Printf("birthday\t%s", bd)
} }
if org, title := primaryOrganization(p); org != "" || title != "" { if org, title := primaryOrganization(p); org != "" || title != "" {
if org != "" && title != "" { switch {
case org != "" && title != "":
u.Out().Printf("organization\t%s (%s)", org, title) u.Out().Printf("organization\t%s (%s)", org, title)
} else if org != "" { case org != "":
u.Out().Printf("organization\t%s", org) u.Out().Printf("organization\t%s", org)
} else { default:
u.Out().Printf("title\t%s", title) u.Out().Printf("title\t%s", title)
} }
} }
@ -247,7 +248,7 @@ func contactsURLs(values []string) []*people.Url {
return out return out
} }
func contactsApplyPersonName(person *people.Person, givenSet bool, given, familySet bool, family string) { func contactsApplyPersonName(person *people.Person, givenSet bool, familySet bool, given, family string) {
curGiven := "" curGiven := ""
curFamily := "" curFamily := ""
if len(person.Names) > 0 && person.Names[0] != nil { if len(person.Names) > 0 && person.Names[0] != nil {
@ -263,7 +264,7 @@ func contactsApplyPersonName(person *people.Person, givenSet bool, given, family
person.Names = []*people.Name{{GivenName: curGiven, FamilyName: curFamily}} person.Names = []*people.Name{{GivenName: curGiven, FamilyName: curFamily}}
} }
func contactsApplyPersonOrganization(person *people.Person, orgSet bool, org, titleSet bool, title string) { func contactsApplyPersonOrganization(person *people.Person, orgSet bool, titleSet bool, org, title string) {
curOrg := "" curOrg := ""
curTitle := "" curTitle := ""
if len(person.Organizations) > 0 && person.Organizations[0] != nil { if len(person.Organizations) > 0 && person.Organizations[0] != nil {
@ -407,7 +408,7 @@ func (c *ContactsUpdateCmd) Run(ctx context.Context, kctx *kong.Context, flags *
wantCustom := flagProvided(kctx, "custom") wantCustom := flagProvided(kctx, "custom")
if wantGiven || wantFamily { if wantGiven || wantFamily {
contactsApplyPersonName(existing, wantGiven, c.Given, wantFamily, c.Family) contactsApplyPersonName(existing, wantGiven, wantFamily, c.Given, c.Family)
updateFields = append(updateFields, "names") updateFields = append(updateFields, "names")
} }
if wantEmail { if wantEmail {
@ -427,7 +428,7 @@ func (c *ContactsUpdateCmd) Run(ctx context.Context, kctx *kong.Context, flags *
updateFields = append(updateFields, "phoneNumbers") updateFields = append(updateFields, "phoneNumbers")
} }
if wantOrg || wantTitle { if wantOrg || wantTitle {
contactsApplyPersonOrganization(existing, wantOrg, c.Organization, wantTitle, c.Title) contactsApplyPersonOrganization(existing, wantOrg, wantTitle, c.Organization, c.Title)
updateFields = append(updateFields, "organizations") updateFields = append(updateFields, "organizations")
} }
if wantURL { if wantURL {
@ -448,11 +449,11 @@ func (c *ContactsUpdateCmd) Run(ctx context.Context, kctx *kong.Context, flags *
updateFields = append(updateFields, "biographies") updateFields = append(updateFields, "biographies")
} }
if wantCustom { if wantCustom {
userDefined, clear, parseErr := parseCustomUserDefined(c.Custom, true) userDefined, clearUserDefined, parseErr := parseCustomUserDefined(c.Custom, true)
if parseErr != nil { if parseErr != nil {
return usage(parseErr.Error()) return usage(parseErr.Error())
} }
if clear { if clearUserDefined {
existing.UserDefined = nil existing.UserDefined = nil
} else { } else {
existing.UserDefined = userDefined existing.UserDefined = userDefined

View File

@ -109,11 +109,11 @@ func TestParseCustomUserDefined_InvalidInput(t *testing.T) {
} }
func TestParseCustomUserDefined_ValidInput(t *testing.T) { func TestParseCustomUserDefined_ValidInput(t *testing.T) {
fields, clear, err := parseCustomUserDefined([]string{"team=devops", " repo = gog"}, false) fields, clearUserDefined, err := parseCustomUserDefined([]string{"team=devops", " repo = gog"}, false)
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
if clear { if clearUserDefined {
t.Fatalf("did not expect clear") t.Fatalf("did not expect clear")
} }
if len(fields) != 2 || fields[0].Key != "team" || fields[0].Value != "devops" || fields[1].Key != "repo" || fields[1].Value != "gog" { if len(fields) != 2 || fields[0].Key != "team" || fields[0].Value != "devops" || fields[1].Key != "repo" || fields[1].Value != "gog" {
@ -122,11 +122,11 @@ func TestParseCustomUserDefined_ValidInput(t *testing.T) {
} }
func TestParseCustomUserDefined_ClearAll(t *testing.T) { func TestParseCustomUserDefined_ClearAll(t *testing.T) {
fields, clear, err := parseCustomUserDefined([]string{""}, true) fields, clearUserDefined, err := parseCustomUserDefined([]string{""}, true)
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
if !clear { if !clearUserDefined {
t.Fatalf("expected clear") t.Fatalf("expected clear")
} }
if len(fields) != 0 { if len(fields) != 0 {