-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from nuclearcat/add-global-config
Add global config
- Loading branch information
Showing
3 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
|
||
import toml | ||
|
||
|
||
def load_toml(settings): | ||
if not settings: | ||
if os.path.exists(".kci-dev.toml"): | ||
settings = ".kci-dev.toml" | ||
else: | ||
homedir = os.path.expanduser("~") | ||
settings = os.path.join(homedir, ".config", "kci-dev.toml") | ||
if not os.path.exists(settings): | ||
raise FileNotFoundError(f"Settings file {settings} not found") | ||
with open(settings) as fp: | ||
config = toml.load(fp) | ||
return config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters