Skip to content

Commit

Permalink
feat: add section aliases (#14)
Browse files Browse the repository at this point in the history
Just like you can use multiple sections, the INI sections themselves can have multiple aliases. For example, you can have the same section under two or more names to avoid duplication:

```ini
; you can use these environment variables by using name "user" or "personal"
[user, personal]
NAME=...
ID=...
```
  • Loading branch information
bahmutov authored Mar 4, 2022
1 parent e6938df commit ec92b2f
Show file tree
Hide file tree
Showing 9 changed files with 14,145 additions and 1,266 deletions.
12 changes: 10 additions & 2 deletions .as-a.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
; example .as-a.ini file used for testing
[testing]
; example .as-a.ini file used for demonstration purposes
[demo]
MY_VARIABLE=42

; same section name as the folder
[as-a]
MY_VARIABLE=42

; the same section that can be loaded using three names
[name-one, name-two, name-three]
MY_VARIABLE=80

; section name with empty aliases
[alias1,, , alias2]
MY_VARIABLE=100
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
- name: Test 🧪
run: npm test

- name: Demo 🎬
run: npm run demo

- name: Demo dot 🎬
run: npm run demo:dot

- name: Semantic Release 🚀
uses: cycjimmy/semantic-release-action@v2
env:
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,24 @@ Resolution
- otherwise an error is thrown


## Section aliases

Just like you can use multiple sections, the INI sections themselves can have multiple aliases. For example, you can have the same section under two or more names to avoid duplication:

```ini
; you can use these environment variables by using name "user" or "personal"
[user, personal]
NAME=...
ID=...
```

These two commands are equivalent

```shell
$ as-a user ...
$ as-a personal ...
```

## Version

To see the version of the installed `as-a` run it without arguments
Expand Down
File renamed without changes.
Loading

0 comments on commit ec92b2f

Please sign in to comment.