33import subprocess
44import sys
55from argparse import ArgumentParser , RawTextHelpFormatter
6- from typing import Any
6+ from typing import Any , List
77
88import dotbot
99from dotbot .config import ConfigReader , ReadingError
@@ -23,8 +23,10 @@ def add_options(parser: ArgumentParser) -> None:
2323 default = 0 ,
2424 help = "enable verbose output\n " "-v: typical verbose\n " "-vv: also, set shell commands stderr/stdout to true" ,
2525 )
26- parser .add_argument ("-d" , "--base-directory" , help = "execute commands from within BASEDIR" , metavar = "BASEDIR" )
27- parser .add_argument ("-c" , "--config-file" , help = "run commands given in CONFIGFILE" , metavar = "CONFIGFILE" )
26+ parser .add_argument ("-d" , "--base-directory" , help = "execute commands from within BASE_DIR" , metavar = "BASE_DIR" )
27+ parser .add_argument (
28+ "-c" , "--config-file" , help = "run commands given in CONFIG_FILE" , metavar = "CONFIG_FILE" , nargs = "+"
29+ )
2830 parser .add_argument (
2931 "-p" ,
3032 "--plugin" ,
@@ -57,8 +59,8 @@ def add_options(parser: ArgumentParser) -> None:
5759 )
5860
5961
60- def read_config (config_file : str ) -> Any :
61- reader = ConfigReader (config_file )
62+ def read_config (config_files : List [ str ] ) -> Any :
63+ reader = ConfigReader (config_files )
6264 return reader .get_config ()
6365
6466
@@ -118,17 +120,13 @@ def main() -> None:
118120 log .error ("No configuration file specified" )
119121 sys .exit (1 )
120122 tasks = read_config (options .config_file )
121- if tasks is None :
122- log .warning ("Configuration file is empty, no work to do" )
123- tasks = []
124- if not isinstance (tasks , list ):
125- msg = "Configuration file must be a list of tasks"
126- raise ReadingError (msg ) # noqa: TRY301
123+ if not tasks :
124+ log .warning ("No tasks given in configuration, no work to do" )
127125 if options .base_directory :
128126 base_directory = os .path .abspath (options .base_directory )
129127 else :
130- # default to directory of config file
131- base_directory = os .path .dirname (os .path .abspath (options .config_file ))
128+ # default to directory of first config file
129+ base_directory = os .path .dirname (os .path .abspath (options .config_file [ 0 ] ))
132130 os .chdir (base_directory )
133131 _all_plugins [:] = plugins # for backwards compatibility, see dispatcher.py
134132 dispatcher = Dispatcher (
0 commit comments