Make error for empty config a little friendlier
In the setup guide in the README, we have people start out with an empty file (created using `touch`). Before this patch, Dotbot gave the following error: Configuration file must be a list of tasks Instead, with this patch, Dotbot says: Configuration file is empty, no work to do This change was prompted by https://github.com/anishathalye/dotbot/pull/226.
This commit is contained in:
parent
043373ea74
commit
c5e709d433
2 changed files with 5 additions and 2 deletions
|
@ -74,6 +74,9 @@ def main():
|
|||
log.error('No configuration file specified')
|
||||
exit(1)
|
||||
tasks = read_config(options.config_file)
|
||||
if tasks is None:
|
||||
log.warning('Configuration file is empty, no work to do')
|
||||
tasks = []
|
||||
if not isinstance(tasks, list):
|
||||
raise ReadingError('Configuration file must be a list of tasks')
|
||||
if options.base_directory:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
test_description='empty config disallowed'
|
||||
test_description='empty config allowed'
|
||||
. '../test-lib.bash'
|
||||
|
||||
test_expect_failure 'run' '
|
||||
test_expect_success 'run' '
|
||||
run_dotbot <<EOF
|
||||
EOF
|
||||
'
|
||||
|
|
Loading…
Reference in a new issue