mirror of https://github.com/pypa/pip
Implement get_file
This commit is contained in:
parent
891a10c6de
commit
558edd6882
|
@ -180,6 +180,11 @@ class ConfigurationCommand(Command):
|
|||
return ERROR
|
||||
|
||||
file = self.configuration.get_file()
|
||||
if file is None:
|
||||
logger.error(
|
||||
"Could not determine appropriate file."
|
||||
)
|
||||
return ERROR
|
||||
|
||||
try:
|
||||
subprocess.check_call([options.editor, file])
|
||||
|
|
|
@ -89,6 +89,14 @@ class Configuration(object):
|
|||
if not self.isolated:
|
||||
self._load_environment_vars()
|
||||
|
||||
def get_file(self):
|
||||
"""Returns the file with highest priority in configuration
|
||||
"""
|
||||
try:
|
||||
return self._get_parser_to_modify()[0]
|
||||
except IndexError:
|
||||
return None
|
||||
|
||||
def items(self):
|
||||
"""Returns key-value pairs like dict.items() representing the loaded
|
||||
configuration
|
||||
|
|
Loading…
Reference in New Issue