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

feat(git): add .LatestTag template property #4422

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

mateusz-bajorek
Copy link
Contributor

@mateusz-bajorek mateusz-bajorek commented Nov 1, 2023

Prerequisites

  • I have read and understood the contributing guide.
  • The commit message follows the conventional commits guidelines.
  • Tests for the changes have been added (for bug fixes / features).
  • Docs have been added/updated (for bug fixes / features).

Description

🤖 Generated by Copilot at 39bff29

This pull request adds a new option to the Git segment to show the latest tag name for the current git repo. It also updates the documentation and the theme schema to reflect the new feature.

How

🤖 Generated by Copilot at 39bff29

  • Add a new feature to the git segment that allows users to display the latest tag name for the git repo in their prompt (link, link, link, link, link, link)
  • Add a new boolean property FetchLatestTag to the segments package and the themes/schema.json file, with a default value of false and a title and description for the user interface (link, link)
  • Add a new string field LatestTag to the Git type, which stores the latest tag name for the git repo (link)
  • Add a new block of code to the Enabled function of the Git type, which checks if the FetchLatestTag property is set to true, and if so, runs a git command to get the latest tag name and assigns it to the LatestTag field (link)
  • Add a new row to the table in the website/docs/segments/git.mdx file, which documents the FetchLatestTag property and its default value and description for the users of the git segment (link)
  • Add a new row to the table in the website/docs/segments/git.mdx file, which documents the .LatestTag template variable and its type and description for the users of the git segment (link)

@JanDeDobbeleer
Copy link
Owner

@mateusz-bajorek thanks for your contribution! I have a suggestion here. If we make LatestTag a function instead of something to enable using a switch, we do not need the switch:

func (g *Git) LatestTag() string {
    return g.getGitCommandOutput("describe", "--tags", "--abbrev=0")
}

@mateusz-bajorek
Copy link
Contributor Author

@JanDeDobbeleer oh nice! I wasn't aware this could get picked up like that, very nifty! PR updated :)

@JanDeDobbeleer JanDeDobbeleer enabled auto-merge (rebase) November 1, 2023 13:50
@JanDeDobbeleer JanDeDobbeleer merged commit 870ff86 into JanDeDobbeleer:main Nov 1, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants