summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-06-06 09:21:29 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2021-06-06 09:21:29 -0600
commitfe51b8a45b8648f9ae763b525c59ff27d8d78eaf (patch)
tree94af57dd448802a05e7af680994f4ad30493e1ef /src
parent765305ca30a142145c1fdf39072086c8502fe71c (diff)
add config to read first pyssgrc and then to the xdg directory
Diffstat (limited to 'src')
-rw-r--r--src/pyssg/pyssg.py9
1 files changed, 8 insertions, 1 deletions
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)