Skip to content
Snippets Groups Projects
Commit cfd2501f authored by Jonathan Maw's avatar Jonathan Maw
Browse files

cli.py: Use utils' search upwards helper when searching for project.conf

parent 6cf4dea3
No related branches found
No related tags found
Loading
......@@ -59,18 +59,9 @@ def complete_target(args, incomplete):
:return: all the possible user-specified completions for the param
"""
from .. import utils
project_conf = 'project.conf'
def ensure_project_dir(directory):
directory = os.path.abspath(directory)
while not os.path.isfile(os.path.join(directory, project_conf)):
parent_dir = os.path.dirname(directory)
if directory == parent_dir:
break
directory = parent_dir
return directory
# First resolve the directory, in case there is an
# active --directory/-C option
#
......@@ -89,7 +80,7 @@ def complete_target(args, incomplete):
else:
# Check if this directory or any of its parent directories
# contain a project config file
base_directory = ensure_project_dir(base_directory)
base_directory = utils._search_upward_for_file(base_directory, project_conf)
# Now parse the project.conf just to find the element path,
# this is unfortunately a bit heavy.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment