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

VCSH should print $VCSH_DIRECTORY #363

Closed
brianmay opened this issue May 7, 2015 · 6 comments
Closed

VCSH should print $VCSH_DIRECTORY #363

brianmay opened this issue May 7, 2015 · 6 comments
Labels
dev env Data sources relating to development environments enhancement Feature request git Related to Git VCS data
Milestone

Comments

@brianmay
Copy link
Contributor

brianmay commented May 7, 2015

Not sure if this is correct, but was thinking something along the lines of:

diff --git a/liquidprompt b/liquidprompt
index a801407..2f17148 100755
--- a/liquidprompt
+++ b/liquidprompt
@@ -1444,7 +1444,7 @@ _lp_smart_mark()
     case "$LP_VCS_TYPE" in
     git)      mark="$LP_MARK_GIT"             ;;
     git-svn)  mark="$LP_MARK_GIT$LP_MARK_SVN" ;;
-    git-vcsh) mark="$LP_MARK_VCSH$LP_MARK_GIT$LP_MARK_VCSH";;
+    git-vcsh) mark="$LP_MARK_VCSH$VCSH_DIRECTORY:$LP_MARK_GIT$LP_MARK_VCSH";;
     hg)       mark="$LP_MARK_HG"              ;;
     svn)      mark="$LP_MARK_SVN"             ;;
     fossil)   mark="$LP_MARK_FOSSIL"          ;;

Now I get:

1d [brian:~] % vcsh enter zsh
1d [brian:~] master(+1/-34) |zsh:±| 
@brianmay brianmay changed the title VCSH should print $VSH_DIRECTORY VCSH should print $VCSH_DIRECTORY May 7, 2015
@dolmen dolmen added enhancement Feature request git Related to Git VCS data dev env Data sources relating to development environments labels May 13, 2015
@dolmen
Copy link
Collaborator

dolmen commented Aug 26, 2015

I need feedback from users of the vcsh feature.

@clneagu, @RichiH: what do you think?

@tribut
Copy link

tribut commented Nov 9, 2016

I agree that it would be really helpful if $VCSH_DIRECTORY was shown for vcsh.

@DancingQuanta
Copy link

Yes I second this feature. Entering a VCSH environment without showing that you entered is a bit confusing, only indicator is that master for git shows up. Liquidprompt already shows virtualenvs, so vcsh should be treated similarly.

@Rycieos Rycieos added this to the v2.1 milestone Jun 30, 2020
@Rycieos
Copy link
Collaborator

Rycieos commented Oct 22, 2020

Stumbled across this issue again while trying to understand how VCSH works. Anyone want to help me understand this?

If one cds into a directory with a VCSH repo, not only will it looks like a Git repo, but $VCSH_DIRECTORY will be set automatically? If that is the case, then Liquidprompt's job is easy, but an environment variable appearing from nowhere seems too good to be true.

@brianmay
Copy link
Contributor Author

brianmay commented Dec 15, 2020

@Rycieos

You type in something like:

vcsh enter common

vcsh will setup various environment variables and enter a new shell. Such as VCSH_COMMAND, VCSH_DIRECTORY and VCSH_REPO_NAME. It also configures git to use the non-standard git directory.

brian@canidae:~$ vcsh enter common
brian@canidae:~$ echo $VCSH_COMMAND
enter
brian@canidae:~$ echo $VCSH_DIRECTORY
common
brian@canidae:~$ echo $VCSH_REPO_NAME
common
brian@canidae:~$ echo $GIT_DIR 
/home/brian/.config/vcsh/repo.d/common.git

Similar to commands like virtualenv, pyenv, and asdf (can't remember if liquidprompt supports any of these).

@Rycieos
Copy link
Collaborator

Rycieos commented Dec 15, 2020

@brianmay thanks! So you don't cd into a VCSH directory, you enabled a VCSH context.

In that case, I understand your request. Your current directory would not help ID the repo you are in, but $VCSH_DIRECTORY would.

I'm not sold on doing the check in _lp_smart_mark(), since it is a theme function, but as @DancingQuanta suggested, since it is more like a development environment, it should probably be added as data source like that, and then displayed in the default theme between the VCS section and the prompt mark. Or maybe even in the prompt mark like you suggested. But it needs its own data function for sure. And then could be disabled with $LP_ENABLE_VCSH (which I just removed because it did nothing, but we can add it back).

If anyone wants to take a stab at a PR for this, feel free. Otherwise I'm leaving this on the plans for v2.1 for myself to work on.

@Rycieos Rycieos closed this as completed in ab1b363 May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev env Data sources relating to development environments enhancement Feature request git Related to Git VCS data
Projects
None yet
Development

No branches or pull requests

5 participants