-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using the wrapper we have cleaner code and consitent behaviour among all commands
- Loading branch information
Showing
5 changed files
with
27 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import click | ||
from conf.config_utils import load_configs | ||
|
||
|
||
def die(msg, exit_code=1, fg='red'): | ||
click.secho('ERROR: ' + msg, fg=fg, err=True) | ||
exit(exit_code) | ||
|
||
|
||
def load_cfg(path, envvar_prefix='LIBREANT_', debug=False): | ||
'''wrapper of config_utils.load_configs''' | ||
try: | ||
return load_configs(envvar_prefix, path=path) | ||
except Exception as e: | ||
if debug: | ||
raise | ||
else: | ||
die(str(e)) |
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
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