https://github.com/kakkun61/powershell-config
PowerShell module to find and read configurations
https://github.com/kakkun61/powershell-config
powershell
Last synced: 6 months ago
JSON representation
PowerShell module to find and read configurations
- Host: GitHub
- URL: https://github.com/kakkun61/powershell-config
- Owner: kakkun61
- License: gpl-3.0
- Created: 2021-08-12T20:52:14.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-23T11:05:09.000Z (over 4 years ago)
- Last Synced: 2025-04-05T01:45:17.951Z (12 months ago)
- Topics: powershell
- Language: PowerShell
- Homepage: https://www.powershellgallery.com/packages/config/
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- Funding: .github/FUNDING.yml
- License: COPYING
Awesome Lists containing this project
README
# powershell-config
[](https://github.com/kakkun61/powershell-config/actions?query=workflow%3Atest) [](https://github.com/kakkun61/powershell-config/actions?query=workflow%3Ainstall) [](https://github.com/kakkun61/powershell-config/actions?query=workflow%3Alint) [](https://www.powershellgallery.com/packages/config/) [](https://github.com/sponsors/kakkun61)
This is a configuration module for PowerShell. This finds configuration files, read them and convert them to `Hashtable`s.
## Specifications
This module treats three types of configurations:
- local configuration
- user global configuration
- system global configuration
## Local configuration
A local configuration is named _`$appname`.yaml_ and located at the current working directory or its parents recursively.
## User global configuration
A user global configuration is named _config.yaml_ and located at _`$Env:APPDATA\$appname`_.
## System global configuration
A system global configuration is named _config.yaml_ and located at _`$Env:ProgramData\$appname`_.
## Overwriting
When the configurations have the same keys, upper ones overwrite.
For example there are following configurations:
```yaml
# local configuration
foo: foo
# user global configuration
bar: bar
# system global configuration
bar: buzz
```
you get:
```yaml
foo: foo
bar: bar
```
`bar: buzz` is overwritten.
# Examples
## Local configuration
When _.\foo.yaml_ is:
```yaml
foo: 1
bar: hello
buzz:
- one
- two
```
call:
```
> Get-Config foo
Name Value
---- -----
bar hello
foo 1
buzz {one, two}
```