Skip to content

Commit 825ac43

Browse files
committed
✨ Add command to enable/disable host name on prompt
New commands: - fancygit --disable-host-name - fancygit --enable-host-name
1 parent 99cde8a commit 825ac43

File tree

9 files changed

+25
-1
lines changed

9 files changed

+25
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ Type `fancygit -h` to see all available feature switchers on **"FEATURE SWITCHER
191191
| fancygit --disable-rich-notification | Show notification area with simple symbols.
192192
| fancygit --enable-bold-prompt | Show bold prompt font.
193193
| fancygit --disable-bold-prompt | Show regular prompt font.
194+
| fancygit --enable-host-name | Show host name.
195+
| fancygit --disable-host-name | Hide host name.
194196
| fancygit --set-user-name {name} | Set the user name.
195197
| fancygit --unset-user-name | Restore the user name to default.
196198
| fancygit --set-host-name {name} | Set the host name.

app_config_sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ ps2:➜
1111
user_name:
1212
host_name:
1313
bold_prompt:false
14+
show_host_prompt:false
1415
fresh_file

commands-handler.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ case "$1" in
4040
"--disable-rich-notification") fancygit_config_save "show_rich_notification" "false";;
4141
"--enable-bold-prompt") fancygit_config_save "bold_prompt" "true";;
4242
"--disable-bold-prompt") fancygit_config_save "bold_prompt" "false";;
43+
"--enable-host-name") fancygit_config_save "show_host_prompt" "true";;
44+
"--disable-host-name") fancygit_config_save "show_host_prompt" "false";;
4345

4446
# Set Name and Host.
4547
"--set-user-name") fancygit_config_save "user_name" "$2";;

fancygit-completion

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ _fancygit() {
2727
--disable-rich-notification \
2828
--enable-bold-prompt \
2929
--disable-bold-prompt \
30+
--enable-host-name \
31+
--disable-host-name \
3032
--set-user-name \
3133
--unset-user-name \
3234
--set-host-name \

help.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ FEATURE SWITCHER COMMANDS:
3535
fancygit --disable-rich-notification Show notification area with simple symbols.
3636
fancygit --enable-bold-prompt Show bold prompt font.
3737
fancygit --disable-bold-prompt Show regular prompt font.
38+
fancygit --enable-host-name Show host name.
39+
fancygit --disable-host-name Hide host name.
3840
3941
THEME COMMANDS:
4042
fancygit --theme-default Change prompt to the default theme.

themes/default.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ fancygit_theme_builder() {
113113
prompt_user="${user_at_host}${user}${user_name}${none}${at}@${none}${host}${host_name}${none} ${user_at_host_end}"
114114
fi
115115

116+
if fancygit_config_is "show_host_prompt" "false"
117+
then
118+
prompt_user="${user_at_host}${user}${user_name}${none}${none} ${user_at_host_end}"
119+
fi
120+
116121
branch_name=$(fancygit_git_get_branch)
117122
if [ "" = "$branch_name" ]
118123
then

themes/human.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ fancygit_theme_builder() {
106106
prompt_user_at_host="${user}${user_name}${color_reset}${at} at ${color_reset}${host}${host_name}${color_reset}${user_at_host_end} in "
107107
fi
108108

109+
if fancygit_config_is "show_host_prompt" "false"
110+
then
111+
prompt_user_at_host="${user}${user_name}${color_reset} in "
112+
fi
113+
109114
if fancygit_config_is "bold_prompt" "true"
110115
then
111116
bold_prompt="$(tput bold)"

themes/simple.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ fancygit_theme_builder() {
6868
user_at_host="$user$at$host:"
6969
fi
7070

71+
if fancygit_config_is "show_host_prompt" "false"
72+
then
73+
user_at_host="$user:"
74+
fi
75+
7176
if [ "" != "$venv_name" ]
7277
then
7378
venv_name="($venv_name) "

version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Author: Diogo Alexsander Cavilha <diogocavilha@gmail.com>
44
# Date: 11.17.2017
55

6-
export FANCYGIT_VERSION="7.3.0"
6+
export FANCYGIT_VERSION="7.4.0"

0 commit comments

Comments
 (0)