diff --git a/src/hike/data/config.py b/src/hike/data/config.py index 25a1a1d..8c81f08 100644 --- a/src/hike/data/config.py +++ b/src/hike/data/config.py @@ -34,6 +34,9 @@ class Configuration: command_line_on_top: bool = False """Should the command line live at the top of the screen?""" + main_branches: list[str] = field(default_factory=lambda: ["main", "master"]) + """The branches considered to be main branches on forges.""" + ############################################################################## def configuration_file() -> Path: diff --git a/src/hike/messages/opening.py b/src/hike/messages/opening.py index 728cf37..7b15d9f 100644 --- a/src/hike/messages/opening.py +++ b/src/hike/messages/opening.py @@ -16,6 +16,7 @@ ############################################################################## # Local imports. from .. import USER_AGENT +from ..data import load_configuration from ..types import HikeLocation @@ -78,7 +79,7 @@ async def url(self) -> URL | None: filename = self.filename or "README.md" async with AsyncClient() as client: for candidate_branch in ( - (self.branch,) if self.branch else ("main", "master") + [self.branch] if self.branch else load_configuration().main_branches ): url = self.raw_url_format.format( owner=self.owner,