9 Commits

Author SHA1 Message Date
Ulf Wiger
4ee669ebba process plain args, update zompify.sh 2025-05-12 23:26:35 +02:00
Ulf Wiger
d0a0d039c0 Zompify (realm: uwiger) 2025-04-24 12:28:05 +02:00
de5d2bfb7d Make config file parsers pluggable (#1)
In order to simplify deps, this PR makes config file formats pluggable. The extensions supported by default are "json" and "eterm".
The default json decoder is the one from OTP, but if one prefers another (e.g. `zj`), it's possible to choose that when installing the gmconfig env.

Example of adding a yaml decoder:
```erlang
instrument_gmconfig() ->
    gmconfig:set_gmconfig_env(gmconfig_env()).

-spec gmconfig_env() -> gmconfig:gmconfig().
gmconfig_env() ->
    #{ ...
     , config_formats => add_yamerl() }.

add_yamerl() ->
    Default = maps:get(config_formats, gmconfig:default_gmconfig_env()),
    case maps:is_key("yaml", Default) of
        true ->
            Default;
        false ->
            Default#{"yaml" => fun yamerl_decode/1}
    end.

yamerl_decode(Bin) ->
    yamerl:decode(Bin, [{str_node_as_binary, true},
                        {map_node_format, map}]).
```

Co-authored-by: Ulf Wiger <ulf@wiger.net>
Reviewed-on: #1
2025-04-02 16:35:38 +09:00
Ulf Wiger
ec02bfed41 Remove config keys check in set_gmconfig_env() 2025-03-09 21:53:32 +01:00
Ulf Wiger
e003452629 Fix typo in .app.src 2025-03-09 12:59:50 +01:00
Ulf Wiger
afad9544bb Add schema helpers 2025-03-07 16:46:10 +01:00
Ulf Wiger
e553a2c338 Add README and export gmconfig() type 2025-02-26 12:13:13 +01:00
Ulf Wiger
eb308e3acd Clean up some lingering gajumaru refs 2025-02-25 12:41:56 +01:00
Ulf Wiger
b40b7ddef4 Initial commit 2025-02-24 22:17:41 +01:00