Skip to content

Commit

Permalink
✨ Add command to enable/disable host name on prompt
Browse files Browse the repository at this point in the history
New commands:
- fancygit --disable-host-name
- fancygit --enable-host-name
  • Loading branch information
diogocavilha committed Apr 11, 2023
1 parent 99cde8a commit 825ac43
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ Type `fancygit -h` to see all available feature switchers on **"FEATURE SWITCHER
| fancygit --disable-rich-notification | Show notification area with simple symbols.
| fancygit --enable-bold-prompt | Show bold prompt font.
| fancygit --disable-bold-prompt | Show regular prompt font.
| fancygit --enable-host-name | Show host name.
| fancygit --disable-host-name | Hide host name.
| fancygit --set-user-name {name} | Set the user name.
| fancygit --unset-user-name | Restore the user name to default.
| fancygit --set-host-name {name} | Set the host name.
Expand Down
1 change: 1 addition & 0 deletions app_config_sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ ps2:➜
user_name:
host_name:
bold_prompt:false
show_host_prompt:false
fresh_file
2 changes: 2 additions & 0 deletions commands-handler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ case "$1" in
"--disable-rich-notification") fancygit_config_save "show_rich_notification" "false";;
"--enable-bold-prompt") fancygit_config_save "bold_prompt" "true";;
"--disable-bold-prompt") fancygit_config_save "bold_prompt" "false";;
"--enable-host-name") fancygit_config_save "show_host_prompt" "true";;
"--disable-host-name") fancygit_config_save "show_host_prompt" "false";;

# Set Name and Host.
"--set-user-name") fancygit_config_save "user_name" "$2";;
Expand Down
2 changes: 2 additions & 0 deletions fancygit-completion
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ _fancygit() {
--disable-rich-notification \
--enable-bold-prompt \
--disable-bold-prompt \
--enable-host-name \
--disable-host-name \
--set-user-name \
--unset-user-name \
--set-host-name \
Expand Down
2 changes: 2 additions & 0 deletions help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ FEATURE SWITCHER COMMANDS:
fancygit --disable-rich-notification Show notification area with simple symbols.
fancygit --enable-bold-prompt Show bold prompt font.
fancygit --disable-bold-prompt Show regular prompt font.
fancygit --enable-host-name Show host name.
fancygit --disable-host-name Hide host name.
THEME COMMANDS:
fancygit --theme-default Change prompt to the default theme.
Expand Down
5 changes: 5 additions & 0 deletions themes/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ fancygit_theme_builder() {
prompt_user="${user_at_host}${user}${user_name}${none}${at}@${none}${host}${host_name}${none} ${user_at_host_end}"
fi

if fancygit_config_is "show_host_prompt" "false"
then
prompt_user="${user_at_host}${user}${user_name}${none}${none} ${user_at_host_end}"
fi

branch_name=$(fancygit_git_get_branch)
if [ "" = "$branch_name" ]
then
Expand Down
5 changes: 5 additions & 0 deletions themes/human.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ fancygit_theme_builder() {
prompt_user_at_host="${user}${user_name}${color_reset}${at} at ${color_reset}${host}${host_name}${color_reset}${user_at_host_end} in "
fi

if fancygit_config_is "show_host_prompt" "false"
then
prompt_user_at_host="${user}${user_name}${color_reset} in "
fi

if fancygit_config_is "bold_prompt" "true"
then
bold_prompt="$(tput bold)"
Expand Down
5 changes: 5 additions & 0 deletions themes/simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ fancygit_theme_builder() {
user_at_host="$user$at$host:"
fi

if fancygit_config_is "show_host_prompt" "false"
then
user_at_host="$user:"
fi

if [ "" != "$venv_name" ]
then
venv_name="($venv_name) "
Expand Down
2 changes: 1 addition & 1 deletion version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 11.17.2017

export FANCYGIT_VERSION="7.3.0"
export FANCYGIT_VERSION="7.4.0"

0 comments on commit 825ac43

Please sign in to comment.