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

Features/git-info #99

Merged
merged 30 commits into from
Jun 14, 2019
Merged

Features/git-info #99

merged 30 commits into from
Jun 14, 2019

Conversation

andresgongora
Copy link
Owner

@andresgongora andresgongora commented Jun 12, 2019

  • Extract getAbridgedPWD and address Rewrite SHORT_PWD and add it to common #57
  • Implement requests from Add GIT related info to fancy-bash-prompt #97
  • Add a new function that updates the git branch name depending on the current directory, to omit the 4th triangle/separator when not needed.
  • Make function more modular such that extra segments can be added in the future in an easier way. Might also solve the above problem of updating git-branch-name.

andresgongora and others added 13 commits May 27, 2019 18:39
Update README in release v1.3
- Automatically has branch current location without always typing "git branch"
- Screenshot updated
Signed-off-by: Andres Gongora <andresgongora@uma.es>
…ill not update

Signed-off-by: Andres Gongora <andresgongora@uma.es>
…mand

Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
@andresgongora
Copy link
Owner Author

Well, it's WAY more ddificult that initially suspected. The main problem is that any function called using the hook PROMPT_COMMAND does not have access to the configuration variables. This implies that the format has to be applied to PS1 externally, which in turn means that the color of the triangles can NOT be changed depending of whether inside a git repository or not... unless the configuration is stored in global variables; which I think is a bad idea.

@olmari
Copy link
Collaborator

olmari commented Jun 12, 2019

I'd say that changing of color is not directly the issue... why would be change colors? I'd say better to not show "4th" bar and connected "arrow" at all when not in git repo, ought to be possible? :)

@andresgongora
Copy link
Owner Author

andresgongora commented Jun 12, 2019 via email

Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
@andresgongora
Copy link
Owner Author

I managed to clean everything up. I still want to make all elements optional, which I think I can do by assembling the PS1 string recursively, starting from the USER INPUT format, and working my way back to USER.

However, I'm still unable to pass format information to PROMPT_COMMAND.

@fiko
Copy link
Contributor

fiko commented Jun 13, 2019

I'm so sorry I wasn't on my laptop since I created that pull request.
I created update on your requests:

  • doc/screenshot.png: Please don't change it for now.
  • terminal/fancy-bash-prompt.sh: change indents from spaces to tabs.
  • condition fourth separator on the presence of a repository. If pwd is not inside of a repository, leave it empty such that it does not display the "triangle" character.

image

@andresgongora
Copy link
Owner Author

@fikoborizqy Has had an idea in which two PS1 prompts are exported, and the one that is shown depends on whether the repository is a git folder or not (see #101 ).

I like this idea. It still means that we are exporting information into the global environment... but this has be ignored for the sake of a beautiful prompt. I will merge #101 (and fix the conflicts) later today, and take the suggestion one step further to select specific elements for the prompt.

Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
@andresgongora
Copy link
Owner Author

Commit 2266522 implements the changes from #101, but merges them with the new format. It hink you will like it, @fikoborizqy.

Still working on making everything optional (i.e. user configurable).

Fiko Borizqy and others added 3 commits June 14, 2019 06:47
- installation error fixed
Include `shorten_path.sh` to the files that are concatenated by `install.sh`
Signed-off-by: Andres Gongora <andresgongora@uma.es>
@andresgongora
Copy link
Owner Author

@fikoborizqy From your screenshot I see dome "noise" around the triangles that make up the prompt. If you want to fix that, consider installing the font HACK. Depending on the nix distribution you are using, it is sually called either ttf-hack or hack-ttf. After you isntall it, you only have to tell your terminal yo use it. Notice the difference:

image

image

Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
Signed-off-by: Andres Gongora <andresgongora@uma.es>
@andresgongora
Copy link
Owner Author

Merging now. It's still not perfect. But it works.
Showing the git branch is now optional (in configuration file) and OFF by default.

@andresgongora andresgongora merged commit 39f25e5 into develop Jun 14, 2019
@andresgongora andresgongora deleted the features/git-info branch June 14, 2019 16:40
@fiko
Copy link
Contributor

fiko commented Jun 14, 2019

@fikoborizqy From your screenshot I see dome "noise" around the triangles that make up the prompt. If you want to fix that, consider installing the font HACK. Depending on the nix distribution you are using, it is sually called either ttf-hack or hack-ttf. After you isntall it, you only have to tell your terminal yo use it. Notice the difference:

image

image

Thank you for your suggestion, it's awecome, I love it ;)
fyi, I's called fonts-hack-ttf on ubuntu

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants