mirror of
https://github.com/httpie/cli.git
synced 2024-12-29 09:49:10 +01:00
parent
f67a11c165
commit
bd50a6adb1
@ -18,19 +18,13 @@ class BaseConfigDict(dict):
|
|||||||
name = None
|
name = None
|
||||||
helpurl = None
|
helpurl = None
|
||||||
about = None
|
about = None
|
||||||
directory = DEFAULT_CONFIG_DIR
|
|
||||||
|
|
||||||
def __init__(self, directory=None, *args, **kwargs):
|
|
||||||
super(BaseConfigDict, self).__init__(*args, **kwargs)
|
|
||||||
if directory:
|
|
||||||
self.directory = directory
|
|
||||||
|
|
||||||
def __getattr__(self, item):
|
def __getattr__(self, item):
|
||||||
return self[item]
|
return self[item]
|
||||||
|
|
||||||
def _get_path(self):
|
def _get_path(self):
|
||||||
"""Return the config file path without side-effects."""
|
"""Return the config file path without side-effects."""
|
||||||
return os.path.join(self.directory, self.name + '.json')
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
def path(self):
|
||||||
@ -94,6 +88,10 @@ class Config(BaseConfigDict):
|
|||||||
'default_options': []
|
'default_options': []
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, directory=DEFAULT_CONFIG_DIR):
|
||||||
super(Config, self).__init__(*args, **kwargs)
|
super(Config, self).__init__()
|
||||||
self.update(self.DEFAULTS)
|
self.update(self.DEFAULTS)
|
||||||
|
self.directory = directory
|
||||||
|
|
||||||
|
def _get_path(self):
|
||||||
|
return os.path.join(self.directory, self.name + '.json')
|
||||||
|
Loading…
Reference in New Issue
Block a user