rawiriblundell / sh_libpath

Making shell scripts more robust with libraries
Apache License 2.0
11 stars 2 forks source link

Create a config loader #30

Open rawiriblundell opened 1 year ago

rawiriblundell commented 1 year ago

As per this reddit comment, it may be useful to have a "sh_confpath", so instead of e.g.

[[ -r /etc/cloudcli.conf ]] && . /etc/cloudcli.conf
[[ -r /opt/cloudcli/etc/cloudcli.conf ]] && . /opt/cloudcli/etc/cloudcli.conf
[[ -r "${HOME:?}/.cloudcli/cloudcli.conf" ]] && . "${HOME}/.cloudcli/cloudcli.conf"
[[ -r "${XDG_CONFIG_HOME:?}/.cloudcli/cloudcli.conf" ]] && . "${XDG_CONFIG_HOME}/.cloudcli/cloudcli.conf"

This becomes

load_conf cloudcli.conf

This could be built into wants() i.e.

wants cloudcli.conf