ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
5.54k stars 626 forks source link

Cupcake theme not working #467

Open R4miZ1z opened 10 months ago

R4miZ1z commented 10 months ago

image

I am getting these errors when using the 'cupcake' theme. I have changed the .sh file for this theme and tried to change the branch icon to a number of things without a change in error, I have also uninstalled and reinstalled oh-my-bash to no avail. Any idea why I may be getting these errors? I am not very big on technical knowledge but will try my best to assist with any requests.

akinomyoga commented 10 months ago

Thank you for the report. It seems there are similar reports, but I cannot reproduce the problem in my environment somehow.

diff --git a/themes/cupcake/cupcake.theme.sh b/themes/cupcake/cupcake.theme.sh
index b50f829..991aaf0 100644
--- a/themes/cupcake/cupcake.theme.sh
+++ b/themes/cupcake/cupcake.theme.sh
@@ -63,7 +63,7 @@ function winname {

 # Displays the current prompt
 function _omb_theme_PROMPT_COMMAND() {
-  PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\W${_omb_prompt_norma>
+  PS1="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")"
   PS2="${icon_end}"
 }
diff --git a/themes/cupcake/cupcake.theme.sh b/themes/cupcake/cupcake.theme.sh
index 991aaf0..24c6e8e 100644
--- a/themes/cupcake/cupcake.theme.sh
+++ b/themes/cupcake/cupcake.theme.sh
@@ -63,7 +63,7 @@ function winname {

 # Displays the current prompt
 function _omb_theme_PROMPT_COMMAND() {
-  PS1="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")"
+  PS1="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on \")"
   PS2="${icon_end}"
 }
diff --git a/themes/cupcake/cupcake.theme.sh b/themes/cupcake/cupcake.theme.sh
index 24c6e8e..a470580 100644
--- a/themes/cupcake/cupcake.theme.sh
+++ b/themes/cupcake/cupcake.theme.sh
@@ -63,7 +63,7 @@ function winname {

 # Displays the current prompt
 function _omb_theme_PROMPT_COMMAND() {
-  PS1="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on \")"
+  PS1='$([[ -n $(echo x) ]] && echo "")'
   PS2="${icon_end}"
 }
R4miZ1z commented 10 months ago
  1. Bash version --> 5.2.12(1)-release

  2. OS Info: Edition Windows 11 Home Version 22H2 Installed on ‎30/‎09/‎2022 OS build 22621.2134 Experience Windows Feature Experience Pack 1000.22659.1000.0

  3. The following is being shown: image

  4. The following is being shown: image

  5. The following is being shown: image

Hope this helps

akinomyoga commented 10 months ago

Thank you for your reply, and sorry for the blank. For Q3..Q5, I wanted to know the status of the error message you reported, but not really the appearance of the prompt. Did you imply that error messages went away with the setups of Q3..Q5?

R4miZ1z commented 9 months ago

Hello, sorry for the extremely late reply, I ran these tests once again, Q3 and Q4 work as shown in the above pictures from my last reply with no errors shown. Q5 is different from the above picture and is now showing nothing. No errors are being shown on any of them however.

akinomyoga commented 9 months ago

Q5 is different from the above picture and is now showing nothing.

I think in the previous time, you tried something like '\$([[ -n $(echo x) ]] && echo "")' instead of '$([[ -n $(echo x) ]] && echo "")'. This small difference affects the whole debugging procedure, so I suggest you to copy and paste the added parts of diffs instead of manually editing for the next questions.

Q3 and Q4 work as shown in the above pictures from my last reply with no errors shown. Q5 is different from the above picture and is now showing nothing. No errors are being shown on any of them however.

Thank you! That means that the settings in Q3..Q5 are working in expected ways. The problem is related to something removed in Q3, i.e., \n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\W${_omb_prompt_normal}. We may bisect this part. Could you try the similar for the following Q6..Q8?

diff --git a/themes/cupcake/cupcake.theme.sh b/themes/cupcake/cupcake.theme.sh
index b50f829..23e2497 100644
--- a/themes/cupcake/cupcake.theme.sh
+++ b/themes/cupcake/cupcake.theme.sh
@@ -63,7 +63,8 @@ function winname {

 # Displays the current prompt
 function _omb_theme_PROMPT_COMMAND() {
-  PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}${_omb_prompt_bold_brown}\u${_omb_prompt_normal}${icon_host}${_omb_prompt_bold_teal}\h${_omb_prompt_normal}${icon_directory}${_omb_prompt_bold_purple}\W${_omb_prompt_norma>
+  PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}\u${icon_host}\h${icon_directory}\W"
+  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")$(scm_prompt_info)\n${icon_end}"
   PS2="${icon_end}"
 }
diff --git a/themes/cupcake/cupcake.theme.sh b/themes/cupcake/cupcake.theme.sh
index 23e2497..9358475 100644
--- a/themes/cupcake/cupcake.theme.sh
+++ b/themes/cupcake/cupcake.theme.sh
@@ -63,8 +63,8 @@ function winname {

 # Displays the current prompt
 function _omb_theme_PROMPT_COMMAND() {
-  PS1="\n${icon_start}$(_omb_prompt_print_python_venv)${icon_user}\u${icon_host}\h${icon_directory}\W"
-  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")$(scm_prompt_info)\n${icon_end}"
+  PS1="\n$(_omb_prompt_print_python_venv)\u\h\W"
+  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")$(scm_prompt_info)"
   PS2="${icon_end}"
 }
diff --git a/themes/cupcake/cupcake.theme.sh b/themes/cupcake/cupcake.theme.sh
index 9358475..d70b43b 100644
--- a/themes/cupcake/cupcake.theme.sh
+++ b/themes/cupcake/cupcake.theme.sh
@@ -63,8 +63,8 @@ function winname {

 # Displays the current prompt
 function _omb_theme_PROMPT_COMMAND() {
-  PS1="\n$(_omb_prompt_print_python_venv)\u\h\W"
-  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")$(scm_prompt_info)"
+  PS1="\n\u\h\W"
+  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")"
   PS2="${icon_end}"
 }
R4miZ1z commented 9 months ago

Q6 resulted in the following errors, these match the errors that I initially received at the start of this issue request.

image

Q7 resulted in no errors with the branch icon being shown correctly and everything.

Q8 once again resulted in no errors and showed the branch icon without the branch name ofc.

akinomyoga commented 9 months ago

Thank you! So it seems to be related to emoji characters.

  PS1="${icon_start}${icon_user}${icon_host}${icon_directory}\W"
  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")"
  PS1="${icon_start}${icon_user}${icon_host}${icon_directory}"
  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")"
  PS1="${icon_host}${icon_directory}"
  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")"
  PS1="${icon_directory}"
  PS1+="\$([[ -n \$(command git branch 2> /dev/null) ]] && echo \" on ${icon_branch}  \")"