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

Feature request: add preview settings everywhere #391

Open
3 tasks done
ccoVeille opened this issue Apr 24, 2024 · 5 comments
Open
3 tasks done

Feature request: add preview settings everywhere #391

ccoVeille opened this issue Apr 24, 2024 · 5 comments
Assignees

Comments

@ccoVeille
Copy link
Contributor

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Idea

I worked on implementing #389, would like me to add something equivalent to forgit log and other commands ?

@ccoVeille
Copy link
Contributor Author

Assign me the issue if you are OK with my ideas.

forgit/bin/git-forgit

Lines 300 to 307 in 2903fef

_forgit_add_preview() {
file=$(echo "$1" | _forgit_get_single_file_from_add_line)
if (git status -s -- "$file" | grep '^??') &>/dev/null; then # diff with /dev/null for untracked files
git diff --color=always --no-index -- /dev/null "$file" | _forgit_pager diff | sed '2 s/added:/untracked:/'
else
git diff --color=always -- "$file" | _forgit_pager diff
fi
}

forgit/bin/git-forgit

Lines 426 to 432 in 2903fef

_forgit_stash_push_preview() {
if _forgit_is_file_tracked "$1"; then
git diff --color=always -- "$1" | _forgit_pager diff
else
git diff --color=always /dev/null "$1" | _forgit_pager diff
fi
}

forgit/bin/git-forgit

Lines 475 to 483 in 2903fef

_forgit_clean_preview() {
local path
path=$1
if [[ -d "$path" ]]; then
eval "$_forgit_dir_view \"$path\""
else
git diff --color=always /dev/null "$path" | _forgit_pager diff
fi
}

...

@ccoVeille
Copy link
Contributor Author

I will have to find something to avoid duplicating code, maybe something like what you did for the pager. I will figure it later, if you are OK with me implementing this

@ccoVeille ccoVeille changed the title Feature request: Feature request: add preview settings everywhere Apr 24, 2024
@carlfriedrich
Copy link
Collaborator

@ccoVeille Thanks for your input and your contribution. I like the idea and would gladly accept a PR introducing this setting for all preview functions instead of just for one (like now done in #389). So before merging that one, let's see if you find a general solution with useful code sharing.

@cjappl @wfxr @sandr01d What do you think?

@ccoVeille
Copy link
Contributor Author

I'll wait for other contributors feedbacks. But OK, I can put everything together.

I'll need time of course

@ccoVeille
Copy link
Contributor Author

But no matter, how I'll do it, it won't affect the variable and the result of the variable I added in #389. So from my perspective it can be merged now. But I'm OK if you want me to implement everything

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

No branches or pull requests

2 participants