From f30d63db8b895afbb3659c5f0bfad7ce26c0afc8 Mon Sep 17 00:00:00 2001 From: Teingi Date: Wed, 12 Jun 2024 19:54:14 +0800 Subject: [PATCH] fixed when -c is a non-existent configuration file path --- cmd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd.py b/cmd.py index a10cc4b1..1e54e4e9 100644 --- a/cmd.py +++ b/cmd.py @@ -211,7 +211,11 @@ def do_command(self): config_path = os.path.expanduser('~/.obdiag/config.yml') custom_config = Util.get_option(self.opts, 'c') if custom_config: - config_path = custom_config + if os.path.exists(os.path.abspath(custom_config)): + config_path = custom_config + else: + ROOT_IO.error('The option you provided with -c: {0} is a non-existent configuration file path.'.format(custom_config)) + return obdiag = ObdiagHome(stdio=ROOT_IO, config_path=config_path) obdiag.set_options(self.opts) obdiag.set_cmds(self.cmds)