Skip to content

changing cliflagv2 to support variadic forcedinclude parameter - #357

Merged
knadh merged 2 commits into
knadh:masterfrom
kooroo:forceinclude_cliflagv2
May 16, 2025
Merged

changing cliflagv2 to support variadic forcedinclude parameter#357
knadh merged 2 commits into
knadh:masterfrom
kooroo:forceinclude_cliflagv2

Conversation

@kooroo

@kooroo kooroo commented May 5, 2025

Copy link
Copy Markdown
Contributor

proposed change to address #356

this changes the provider function definition to a variadic one that allows passing a []string at the end which lists flags that should be loaded up even if they weren't set explicitly (default values). This should preserve current functionality for any current code using this provider without breaking, but enable calling the provider via

k.Load(cliflagv2.Provider(c, ".", []string{"flag1", "flag3"}), nil)

which will load flag1 and flag3 into the koanf object with whatever they contain (default values, zero values, other shenaniganery and tomfoolery).

@knadh

knadh commented May 9, 2025

Copy link
Copy Markdown
Owner

I think the better approach is to add a new function ProviderWithConfig(".", Config{..}) and have Config{ Defaults: []string } or something along those lines.

@kooroo

kooroo commented May 14, 2025

Copy link
Copy Markdown
Contributor Author

I think the better approach is to add a new function ProviderWithConfig(".", Config{..}) and have Config{ Defaults: []string } or something along those lines.

I made changes. Does this fit better with what you were thinking?

you have to load it via something like
k.Load(cliflagv2.ProviderWithConfig(c, ".", &cliflagv2.Config{Defaults: []string{"flag1", "flag3"}}), nil)

@knadh knadh added the enhancement New feature or request label May 16, 2025
@knadh
knadh merged commit 6e430e8 into knadh:master May 16, 2025
Maks1mS pushed a commit to stplr-dev/stplr that referenced this pull request May 10, 2026
….2.1 (#429)

This PR contains the following updates:

| Package | Type | Update | Change | OpenSSF |
|---|---|---|---|---|
| [github.com/knadh/koanf/parsers/toml/v2](https://github.com/knadh/koanf) | require | patch | `v2.2.0` → `v2.2.1` | [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/knadh/koanf/badge)](https://securityscorecards.dev/viewer/?uri=github.com/knadh/koanf) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/23) for more information.

---

### Release Notes

<details>
<summary>knadh/koanf (github.com/knadh/koanf/parsers/toml/v2)</summary>

### [`v2.2.1`](https://github.com/knadh/koanf/releases/tag/v2.2.1)

[Compare Source](knadh/koanf@v2.2.0...v2.2.1)

#### What's Changed

- Bump github.com/nats-io/nats-server/v2 from 2.9.23 to 2.10.27 in /providers/nats by [@&#8203;dependabot](https://github.com/dependabot) in [#&#8203;350](knadh/koanf#350)
- Bump golang.org/x/net from 0.36.0 to 0.38.0 in /providers/consul by [@&#8203;dependabot](https://github.com/dependabot) in [#&#8203;351](knadh/koanf#351)
- Bump golang.org/x/net from 0.37.0 to 0.38.0 in /examples by [@&#8203;dependabot](https://github.com/dependabot) in [#&#8203;353](knadh/koanf#353)
- changing cliflagv2 to support variadic forcedinclude parameter by [@&#8203;kooroo](https://github.com/kooroo) in [#&#8203;357](knadh/koanf#357)
- adds urfave/cli/v3 parser by [@&#8203;n0cloud](https://github.com/n0cloud) in [#&#8203;361](knadh/koanf#361)
- add toggle to split nats kv on "." delimiter by [@&#8203;nickchomey](https://github.com/nickchomey) in [#&#8203;355](knadh/koanf#355)

#### New Contributors

- [@&#8203;kooroo](https://github.com/kooroo) made their first contribution in [#&#8203;357](knadh/koanf#357)
- [@&#8203;n0cloud](https://github.com/n0cloud) made their first contribution in [#&#8203;361](knadh/koanf#361)
- [@&#8203;nickchomey](https://github.com/nickchomey) made their first contribution in [#&#8203;355](knadh/koanf#355)

**Full Changelog**: <knadh/koanf@v2.2.0...v2.2.1>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At 12:00 AM through 04:59 AM and 10:00 PM through 11:59 PM, Monday through Friday (`* 0-4,22-23 * * 1-5`)
  - Only on Sunday and Saturday (`* * * * 0,6`)
- Automerge
  - At any time (no schedule defined)

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

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

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

---

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

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMzIuMyIsInVwZGF0ZWRJblZlciI6IjQzLjEzMi4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJLaW5kL0RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://altlinux.space/stapler/stplr/pulls/429
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants