Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using wildcards in config include paths #3862

Merged
merged 1 commit into from
Jan 12, 2025

Conversation

emar10
Copy link
Contributor

@emar10 emar10 commented Jan 3, 2025

Since Waybar supports including additional configuration files using the "include" key, I expected to be able to use wildcards in the paths passed in. For example, a drop-in config directory:

{
  "include": "/etc/waybar/config.d/*.jsonc"
}

Currently, this almost works. Config::tryExpandPath() already expands wildcards using wordexp(), but only takes the first result and discards the rest.

This PR updates Config::tryExpandPath() to return a vector of expanded path matches instead of a single path wrapped in an optional, with an empty vector indicating no matches.

Config::resolveConfigIncludes() iterates over all of these matches, while other instances of path expansion (such as finding the base config path) retain their existing behavior and only use the first match.

Updates `Config::tryExpandPath()` to return a vector of expanded path
matches instead of a single path wrapped in an optional, with an empty
vector indicating no matches.

`Config::resolveConfigIncludes()` iterates over all of these matches,
while other instances of path expansion (such as finding the base config
path) retain their existing behavior and only use the first match.
@Alexays Alexays merged commit ab0acd0 into Alexays:master Jan 12, 2025
@Alexays
Copy link
Owner

Alexays commented Jan 12, 2025

LGTM, thx!

@emar10 emar10 deleted the config-include-wildcards branch January 12, 2025 23:34
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