From 3ebefe77c4119b562c33364edf8e6404aa1d78e1 Mon Sep 17 00:00:00 2001 From: Will Badart Date: Mon, 20 Apr 2020 18:37:59 -0700 Subject: [PATCH] Option to specify config file with environment variable --- yamllint/cli.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/yamllint/cli.py b/yamllint/cli.py index e99fd2c..ad54b44 100644 --- a/yamllint/cli.py +++ b/yamllint/cli.py @@ -144,8 +144,10 @@ def run(argv=None): args = parser.parse_args(argv) + if 'YAMLLINTRC' in os.environ: + user_global_config = os.path.expanduser(os.environ['YAMLLINTRC']) # User-global config is supposed to be in ~/.config/yamllint/config - if 'XDG_CONFIG_HOME' in os.environ: + elif 'XDG_CONFIG_HOME' in os.environ: user_global_config = os.path.join( os.environ['XDG_CONFIG_HOME'], 'yamllint', 'config') else: