Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the list of main branches configurable #7

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/hike/data/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/hike/messages/opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
##############################################################################
# Local imports.
from .. import USER_AGENT
from ..data import load_configuration
from ..types import HikeLocation


Expand Down Expand Up @@ -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,
Expand Down
Loading