Expose Config.workdir property.

This is a useful proxy to avoid using `Config.get('workdir')` string
lookup.
This commit is contained in:
Fabio Manganiello 2023-07-22 15:11:58 +02:00
parent c846c61493
commit d49e5b1f6a
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -460,6 +460,16 @@ class Config:
""" """
return cls._get_instance(cfgfile, force_reload=True) return cls._get_instance(cfgfile, force_reload=True)
@classmethod
@property
def workdir(cls) -> str:
"""
:return: The path of the configured working directory.
"""
workdir = cls._get_instance().get('workdir')
assert workdir
return workdir # type: ignore
@classmethod @classmethod
def get(cls, key: Optional[str] = None): def get(cls, key: Optional[str] = None):
""" """