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

add _lp_git_staged_lines and _lp_git_staged_files for themes #644

Closed
Orgams opened this issue Jan 10, 2021 · 5 comments · Fixed by #645
Closed

add _lp_git_staged_lines and _lp_git_staged_files for themes #644

Orgams opened this issue Jan 10, 2021 · 5 comments · Fixed by #645
Assignees
Labels
enhancement Feature request git Related to Git VCS data
Milestone

Comments

@Orgams
Copy link

Orgams commented Jan 10, 2021

Description

Hello, i customize a power line theme and i has surprise by the base commend git for _lp_git_uncommitted_lines : is the addition of diff in working and stage.

maybe add _lp_git_staged_lines and _lp_git_staged_files for themes

How will this be useful?

Can use this for show diff line/file in working ant staging zone in same time

Example prompt

image

PS : with a little help i can make a PR

@Orgams Orgams added the enhancement Feature request label Jan 10, 2021
@Rycieos
Copy link
Collaborator

Rycieos commented Jan 10, 2021

I am not completely sure I understand what you are asking for.

i has surprise by the base commend git for _lp_git_uncommitted_lines

I think you are misunderstanding the code in _lp_vcs_details_color():
https://github.com/nojhan/liquidprompt/blob/7c4958bb4c0c3a33f620005e0fb92abd60bd18b7/liquidprompt#L1279-L1291

This section will detect if a VCS provider supports a staging area (like Git) or not (like Mercurial), and if it does, show the diff to staging, and if not, show the diff to the last commit.

Are you asking for the default theme to show both staged and uncommitted line counts? I doubt that many users would find that very helpful, and keeping the default theme the same as users have come to expect is important. But you are welcome to create a theme that does that. If you do, I would want to see it.

Please correct me if I did not understand your request.

@Rycieos Rycieos closed this as completed Jan 10, 2021
@Rycieos Rycieos added the rejected feature A rejected feature request either because it is outside the project's scope, or it is not possible label Jan 10, 2021
@Orgams
Copy link
Author

Orgams commented Jan 10, 2021

After thinking about it, do not modify _lp_git_uncommitted_lines but maybe create a new :

  • _lp_git_uncommitted_lines use git diff --shortstat HEAD (exists)
  • _lp_git_unstaged_lines use git diff --shortstat (exists)
  • _lp_git_staged_lines use git diff --shortstat --cached (new)

Not to integrate it in the default LiquidPrompt but to use it in the theme

@Rycieos
Copy link
Collaborator

Rycieos commented Jan 10, 2021

After thinking about it, do not modify _lp_git_uncommitted_lines but maybe create a new :

  • _lp_git_staged_lines use git diff --shortstat --cached (new)

Not to integrate it in the default LiquidPrompt but to use it in the theme

I'm fine with that. I had considered adding a _lp_vcs_staged_files() and _lp_vcs_staged_lines() before, but didn't since I wasn't going to add them to the default theme, and had not thought of a theme that would use them. But if you could find a use for them, sure, I can add them.

@Rycieos Rycieos reopened this Jan 10, 2021
@Rycieos Rycieos added git Related to Git VCS data and removed rejected feature A rejected feature request either because it is outside the project's scope, or it is not possible labels Jan 10, 2021
@Rycieos Rycieos added this to the v2.0 milestone Jan 10, 2021
@Rycieos Rycieos self-assigned this Jan 10, 2021
@Rycieos
Copy link
Collaborator

Rycieos commented Jan 11, 2021

The linked PR is a proposed fix. Could you give it a try and see if it is what you were expecting?

The docs for the new functions can be found here.

@Orgams
Copy link
Author

Orgams commented Jan 14, 2021

I look this in WE.
Thank you!

pkkolos pushed a commit to pkkolos/liquidprompt that referenced this issue May 9, 2021
I considered making these when I did the overall VCS rework, but thought
that since the default theme does not use it, it was pointless. But now
that a user has requested it, why not.

Fixes liquidprompt#644
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request git Related to Git VCS data
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants