From fe51b8a45b8648f9ae763b525c59ff27d8d78eaf Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sun, 6 Jun 2021 09:21:29 -0600 Subject: add config to read first pyssgrc and then to the xdg directory --- src/pyssg/pyssg.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pyssg/pyssg.py b/src/pyssg/pyssg.py index f579aba..3c75e3c 100644 --- a/src/pyssg/pyssg.py +++ b/src/pyssg/pyssg.py @@ -27,6 +27,7 @@ def get_options() -> Namespace: default='$XDG_CONFIG_HOME/pyssg/pyssgrc', type=str, help='''config file (path) to read from; defaults to + 'pyssgrc' first, then '$XDG_CONFIG_HOME/pyssg/pyssgrc' ''') parser.add_argument('-s', '--src', default='src', @@ -99,7 +100,13 @@ def main() -> None: conf_path: str = opts['config'] conf_path = os.path.expandvars(conf_path) - config: Configuration = Configuration(conf_path) + + config: Configuration = None + if os.path.exists('pyssgrc'): + config = Configuration('pyssgrc') + else: + config = Configuration(conf_path) + config.read() config.fill_missing(opts) -- cgit v1.2.3-70-g09d2