Skip to content

pkg/config: accept string shorthand for the projects list#53

Merged
textfuel merged 2 commits intotextfuel:mainfrom
SAY-5:fix/projects-string-shorthand
Apr 18, 2026
Merged

pkg/config: accept string shorthand for the projects list#53
textfuel merged 2 commits intotextfuel:mainfrom
SAY-5:fix/projects-string-shorthand

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented Apr 17, 2026

Problem

The config schema declares

type Config struct {
    ...
    Projects []ProjectConfig `yaml:"projects"`
}

type ProjectConfig struct {
    Key     string `yaml:"key"`
    BoardID int    `yaml:"boardId"`
}

so the most natural form that users reach for:

projects:
  - ORCH
  - PLAT

errors out of yaml.v3 with cannot unmarshal !!str into config.ProjectConfig.
On v2.8.1 this bubbled up through cfg, _ := config.Load() as a nil *Config
and crashed with a SIGSEGV the moment resolveClient touched cfg.Jira.Host
(#41). main.go already returns the error cleanly, so the crash itself is
gone, but the shorthand form still isn't accepted.

Fix

Add UnmarshalYAML to ProjectConfig so it accepts either form:

projects:
  - ORCH            # scalar: Key only, BoardID defaults to 0
  - key: DATA       # mapping: full form
    boardId: 7

Scalar nodes are decoded straight into Key. Mapping nodes go through a
local type alias so the method doesn't recurse into itself. Added a test
that covers both forms in the same list.

Refs #41

@SAY-5 SAY-5 requested a review from textfuel as a code owner April 17, 2026 20:17
textfuel
textfuel previously approved these changes Apr 18, 2026
Copy link
Copy Markdown
Owner

@textfuel textfuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix, thx!

@textfuel
Copy link
Copy Markdown
Owner

could you resolve the merge conflicts with main so I can merge

A config.yml entry of the form

	projects:
	  - ORCH

panicked lazyjira on startup with
	panic: runtime error: invalid memory address or nil pointer dereference
		main.resolveClient(0x0)
			cmd/lazyjira/main.go:155 +0xc0

because `projects:` is typed as []ProjectConfig. yaml.v3 refuses to map
a scalar into a struct and returns "cannot unmarshal !!str into
config.ProjectConfig", which Load() propagated as (nil, err) and
resolveClient happily dereferenced anyway.

Give ProjectConfig a custom UnmarshalYAML that treats scalar nodes as
the Key value and falls through to the normal struct decode for full
mapping nodes. A type alias is used for the struct branch so the
fallthrough does not recurse into this method. Both forms can now be
mixed in the same list, which matches what the docs / README imply
when they show single-string entries.

Fixes textfuel#41

Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
@SAY-5 SAY-5 force-pushed the fix/projects-string-shorthand branch from eaa9c8c to 48b8c56 Compare April 18, 2026 07:25
@SAY-5
Copy link
Copy Markdown
Contributor Author

SAY-5 commented Apr 18, 2026

Thanks for the review! Rebased on top of latest main, conflicts resolved. Ready to merge when you are.

@textfuel textfuel merged commit 5728a57 into textfuel:main Apr 18, 2026
2 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request May 8, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [textfuel/lazyjira](https://github.com/textfuel/lazyjira) | minor | `v2.9.0` → `v2.13.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>textfuel/lazyjira (textfuel/lazyjira)</summary>

### [`v2.13.0`](https://github.com/textfuel/lazyjira/releases/tag/v2.13.0)

[Compare Source](textfuel/lazyjira@v2.12.0...v2.13.0)

#### Changelog

- [`16a6dd6`](textfuel/lazyjira@16a6dd6) Merge branch 'hotfixes-of-demo-check'
- [`11ba667`](textfuel/lazyjira@11ba667) Reach parents and children from the task list ([#&#8203;68](textfuel/lazyjira#68))
- [`26afc79`](textfuel/lazyjira@26afc79) Show parent-link children in Sub tab on Cloud ([#&#8203;66](textfuel/lazyjira#66))
- [`d5f63df`](textfuel/lazyjira@d5f63df) changelog
- [`34ab861`](textfuel/lazyjira@34ab861) changelog
- [`5dbd650`](textfuel/lazyjira@5dbd650) codowners adjustments
- [`6aa089d`](textfuel/lazyjira@6aa089d) fixes
- [`d22816b`](textfuel/lazyjira@d22816b) release v2.13.0

***

**Full changelog:** [CHANGELOG.md](https://github.com/textfuel/lazyjira/blob/main/CHANGELOG.md)

### [`v2.12.0`](https://github.com/textfuel/lazyjira/releases/tag/v2.12.0)

[Compare Source](textfuel/lazyjira@v2.11.1...v2.12.0)

#### Changelog

- [`6af4d03`](textfuel/lazyjira@6af4d03) Feat/task status icons ([#&#8203;64](textfuel/lazyjira#64))
- [`a19773b`](textfuel/lazyjira@a19773b) changelog
- [`4ca1ee7`](textfuel/lazyjira@4ca1ee7) release v2.12.0
- [`c476e2b`](textfuel/lazyjira@c476e2b) sprint fields ([#&#8203;48](textfuel/lazyjira#48))

***

**Full changelog:** [CHANGELOG.md](https://github.com/textfuel/lazyjira/blob/main/CHANGELOG.md)

### [`v2.11.1`](https://github.com/textfuel/lazyjira/releases/tag/v2.11.1)

[Compare Source](textfuel/lazyjira@v2.11.0...v2.11.1)

#### Changelog

- [`29ca5ae`](textfuel/lazyjira@29ca5ae) Route to tracking only on exact remote match ([#&#8203;62](textfuel/lazyjira#62))
- [`5516244`](textfuel/lazyjira@5516244) release v2.11.1

***

**Full changelog:** [CHANGELOG.md](https://github.com/textfuel/lazyjira/blob/main/CHANGELOG.md)

### [`v2.11.0`](https://github.com/textfuel/lazyjira/releases/tag/v2.11.0)

[Compare Source](textfuel/lazyjira@v2.10.2...v2.11.0)

#### Changelog

- [`382fe06`](textfuel/lazyjira@382fe06) changelog
- [`23b6d49`](textfuel/lazyjira@23b6d49) feat: add catppuccin theme support ([#&#8203;59](textfuel/lazyjira#59))
- [`ced4b10`](textfuel/lazyjira@ced4b10) readme v2 path
- [`9d434fc`](textfuel/lazyjira@9d434fc) release v2.11.0
- [`e570d8b`](textfuel/lazyjira@e570d8b) some dev QOL ([#&#8203;60](textfuel/lazyjira#60))

***

**Full changelog:** [CHANGELOG.md](https://github.com/textfuel/lazyjira/blob/main/CHANGELOG.md)

### [`v2.10.2`](https://github.com/textfuel/lazyjira/releases/tag/v2.10.2)

[Compare Source](textfuel/lazyjira@v2.10.1...v2.10.2)

#### Changelog

- [`94fafd7`](textfuel/lazyjira@94fafd7) fix of v2 version naming ([#&#8203;57](textfuel/lazyjira#57))
- [`86f48fe`](textfuel/lazyjira@86f48fe) release v2.10.2

***

**Full changelog:** [CHANGELOG.md](https://github.com/textfuel/lazyjira/blob/main/CHANGELOG.md)

### [`v2.10.1`](https://github.com/textfuel/lazyjira/releases/tag/v2.10.1)

[Compare Source](textfuel/lazyjira@v2.10.0...v2.10.1)

#### Changelog

- [`fe34157`](textfuel/lazyjira@fe34157) changelog
- [`5728a57`](textfuel/lazyjira@5728a57) pkg/config: accept string shorthand for the projects list ([#&#8203;53](textfuel/lazyjira#53))
- [`cce7280`](textfuel/lazyjira@cce7280) release v2.10.1

***

**Full changelog:** [CHANGELOG.md](https://github.com/textfuel/lazyjira/blob/main/CHANGELOG.md)

### [`v2.10.0`](https://github.com/textfuel/lazyjira/releases/tag/v2.10.0)

[Compare Source](textfuel/lazyjira@v2.9.0...v2.10.0)

#### Changelog

- [`45afec5`](textfuel/lazyjira@45afec5) Add configurable custom commands ([#&#8203;42](textfuel/lazyjira#42))
- [`851bfa1`](textfuel/lazyjira@851bfa1) Context-sensitive preview for Sub/Lnk tabs ([#&#8203;55](textfuel/lazyjira#55))
- [`f546bc7`](textfuel/lazyjira@f546bc7) Make maxResults configurable globally and per tab ([#&#8203;45](textfuel/lazyjira#45))
- [`672fb6d`](textfuel/lazyjira@672fb6d) changelog
- [`67bdf1a`](textfuel/lazyjira@67bdf1a) changelog
- [`d14fb0e`](textfuel/lazyjira@d14fb0e) perl for make release
- [`b04c7a8`](textfuel/lazyjira@b04c7a8) release v2.10.0

***

**Full changelog:** [CHANGELOG.md](https://github.com/textfuel/lazyjira/blob/main/CHANGELOG.md)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNjguNSIsInVwZGF0ZWRJblZlciI6IjQzLjE2OC41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6bWlub3IiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants