Scriptim/bash-prompt-generator

Cannot import Ubuntu 20.04 prompt

jxu opened this issue · 3 comments

jxu commented

Sorry for the issue spam. Here is the default PS1 that comes with my Ubuntu 20.04:

\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$

Pasting this into the website will make it complain about debian_chroot

The ${debian_chroot:+($debian_chroot)} syntax should work now with 817e013. However, the Debian prompt uses a different syntax for color escape codes which is not supported by the generator/parser as of now.

I've found that it also complains with other prompts eg:
Kali default: \[\e]0;\u@\h: \w\a\]\[\033[;94m\]┌──${debian_chroot:+($debian_chroot)──}${VIRTUAL_ENV:+(\[\033[0;1m\]$(basename $VIRTUAL_ENV)\[\033[;94m\])}(\[\033[1;31m\]\u㉿\h\[\033[;94m\])-[\[\033[0;1m\]\w\[\033[;94m\]]\n\[\033[;94m\]└─\[\033[1;31m\]\$\[\033[0m\]

image

And my own personal one failing altogether although working.
Personal PS1:\[\e]0;\u@\h: \w\a\]\[\e[92m\]\u\[\e[96m\]@\[\e[92m\]\H\[\e[0m\] \[\e[93m\]|\[\e[0m\] \w \[\e[93m\]|\[\e[0m\] ${PS1_CMD1} \[\e[93m\]|\[\e[0m\]${PS1_CMD2} \[\e[0m\]>\[\e[30m\]\[\e[0m\]
Personal Prompt CMD: PS1_CMD1=$(ip route get 1.1.1.1 | awk -F"src " 'NR == 1{ split($2, a," ");print a[1]}'); PS1_CMD2=$(__git_ps1 " (%s)")
image

Escape sequences using \033 (octal) or \x1b (hexadecimal) instead of \e are now supported in the parser with 6d9f952. The generator will still always produce \e.

The \[\e]0;...\a\] escape syntax for setting the Xterm window title (see here) is also supported via the Set Window Title element with 043f37a.

Importing the above prompts should work now; please let me know if it doesn't.