Closed karenc closed 8 years ago
Why make context optional? From what I can tell, if I'm in my home directory, then the context becomes 'pumazi'. This will inevitably lead to missing migrations directory warning and possible confusion on my part.
Printing a message that we are using CWD directory name as the context should be sufficient though.
diff --git a/dbmigrator/cli.py b/dbmigrator/cli.py
index afb73c0..643c181 100644
--- a/dbmigrator/cli.py
+++ b/dbmigrator/cli.py
@@ -47,7 +47,10 @@ def main(argv=sys.argv[1:]):
], args)
if not args.get('context'):
- args['context'] = os.path.split(os.path.abspath(os.path.curdir))[-1]
+ args['context'] = os.path.basename(os.path.abspath(os.path.curdir))
+ print('context undefined, using current directory name "{}"'
+ .format(args['context']),
+ file=sys.stderr)
utils.get_settings_from_entry_points(args, args['context'])
for name, value in DEFAULTS.items():
Yeah, that change looks good. :+1:
If context is not defined, the current working directory name is used.
Close #6