Bash-it / bash-it

A community Bash framework.
MIT License
14.31k stars 2.29k forks source link

[Bug]: bash-it preview is not working #2197

Open kgwooo opened 1 year ago

kgwooo commented 1 year ago

Expected behavior

The themes should be displayed!

Current behavior

This is the output following the "bash-it preview" command:

Previewing Bash-it Themes

[kgw@garuda2 ~]$ _bash-it-flash-term "${#BASH_IT_THEME}" "${BASH_IT_THEME}" [kgw@garuda2 ~]$ exit

Possible solution

No response

Context

No response

Steps to reproduce

enter "bash-it preview" into the terminal.

Bash-it version

Version type: stable Current tag: v3.0.3

List of enabled plugins, themes and aliases

bobby, general

Bash version

GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

Operating system and version

Kernel: 5.15.93-1-MANJARO x86_64

bash-it doctor output

# How to get: bash-it doctor
```DEBUG: core: main: Loading libraries(except appearance)...
DEBUG: lib: colors: Loading library file...
DEBUG: lib: command_duration: Loading library file...
DEBUG: lib: helpers: Loading library file...
DEBUG: lib: history: Loading library file...
DEBUG: lib: log: Loading library file...
DEBUG: lib: preexec: Loading library file...
DEBUG: lib: preview: Loading library file...
DEBUG: lib: search: Loading library file...
DEBUG: lib: utilities: Loading library file...
DEBUG: core: reloader: Loading all enabled components...
DEBUG: aliases: bash-it: Loading component...
DEBUG: aliases: bash-it: Loaded.
DEBUG: aliases: fuck: Loading component...
DEBUG: aliases: fuck: Loaded.
DEBUG: aliases: general: Loading component...
bash: pi#: command not found
DEBUG: aliases: general: Command 'gshuf' does not exist
DEBUG: aliases: general: Loaded.
DEBUG: aliases: git: Loading component...
DEBUG: aliases: git: Loaded.
DEBUG: aliases: systemd: Loading component...
DEBUG: aliases: systemd: Loaded.
 WARN: core: reloader: Using legacy enabling for aliases, please update your bash-it version and migrate
ERROR: core: reloader: Unable to locate /home/kgw/.bash_it/aliases/enabled/*.bash
 WARN: core: reloader: Using legacy enabling for plugins, please update your bash-it version and migrate
ERROR: core: reloader: Unable to locate /home/kgw/.bash_it/plugins/enabled/*.bash
 WARN: core: reloader: Using legacy enabling for completion, please update your bash-it version and migrate
ERROR: core: reloader: Unable to locate /home/kgw/.bash_it/completion/enabled/*.bash
DEBUG: core: main: Loading theme 'bobby'.
DEBUG: core: main: Loading custom aliases, completion, plugins...
DEBUG: core: main: Loading general custom files...
DEBUG: custom: example: Loading custom file...
DEBUG: core: main: Command 'gloobus-preview' does not exist

### Your ~/.bashrc

```bash
# How to get: cat ~/.bashrc

If not running interactively, don't do anything case $- in i) ;; *) return;; esac

Path to the bash it configuration

export BASH_IT="/home/kgw/.bash_it"

Lock and Load a custom theme file.

Leave empty to disable theming.

location /.bash_it/themes/

export BASH_IT_THEME='bobby'

Some themes can show whether sudo has a current token or not.

Set $THEME_CHECK_SUDO to true to check every prompt:

THEME_CHECK_SUDO='true'

(Advanced): Change this to the name of your remote repo if you

cloned bash-it with a remote other than origin such as bash-it.

export BASH_IT_REMOTE='bash-it'

(Advanced): Change this to the name of the main development branch if

you renamed it or if it was changed for some reason

export BASH_IT_DEVELOPMENT_BRANCH='master'

Your place for hosting Git repos. I use this for private repos.

export GIT_HOSTING='git@git.domain.com'

Don't check mail when opening terminal.

unset MAILCHECK

Change this to your console based IRC client of choice.

export IRC_CLIENT='irssi'

Set this to the command you use for todo.txt-cli

export TODO="t"

Set this to the location of your work or project folders

BASH_IT_PROJECT_PATHS="${HOME}/Projects:/Volumes/work/src"

Set this to false to turn off version control status checking within the prompt for all themes

export SCM_CHECK=true

Set to actual location of gitstatus directory if installed

export SCM_GIT_GITSTATUS_DIR="$HOME/gitstatus"

per default gitstatus uses 2 times as many threads as CPU cores, you can change this here if you must

export GITSTATUS_NUM_THREADS=8

Set Xterm/screen/Tmux title with only a short hostname.

Uncomment this (or set SHORT_HOSTNAME to something else),

Will otherwise fall back on $HOSTNAME.

export SHORT_HOSTNAME=$(hostname -s)

Set Xterm/screen/Tmux title with only a short username.

Uncomment this (or set SHORT_USER to something else),

Will otherwise fall back on $USER.

export SHORT_USER=${USER:0:8}

If your theme use command duration, uncomment this to

enable display of last command duration.

export BASH_IT_COMMAND_DURATION=true

You can choose the minimum time in seconds before

command duration is displayed.

export COMMAND_DURATION_MIN_SECONDS=1

Set Xterm/screen/Tmux title with shortened command and directory.

Uncomment this to set.

export SHORT_TERM_LINE=true

Set vcprompt executable path for scm advance info in prompt (demula theme)

https://github.com/djl/vcprompt

export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt

(Advanced): Uncomment this to make Bash-it reload itself automatically

after enabling or disabling aliases, plugins, and completions.

export BASH_IT_AUTOMATIC_RELOAD_AFTER_CONFIG_CHANGE=1

Uncomment this to make Bash-it create alias reload.

export BASH_IT_RELOAD_LEGACY=1

Load Bash It

source "$BASH_IT"/bash_it.sh

2023-02-19 10:40:06 ⌚ garuda2 in ~ ○ →

Notes

No response

davidpfarrell commented 1 year ago

Greetings! A quick Q:

Q: What are the contents of _bash-it-flash-term ?

Is it an alias, or a script?

If its a script, try sourcing it ala source _bash-it-flash-term ... and see if it works better?

matthewdavis commented 9 months ago

I'm having the same issue. Just created a new/fresh test user. I don't have a flash-term dir/file. However I see the function in ~/.bash_it/lib/search.bash

function _bash-it-flash-term() {
        local -i len="${1:-0}" # redundant
        local term="${2:-}"
        # as currently implemented, `$match` has already been printed to screen the first time
        local delay=0.2
        local color
        [[ "${#term}" -gt 0 ]] && len="${#term}"

        for color in "${echo_black-}" "${echo_bold_blue-}" "${echo_bold_yellow-}" "${echo_bold_red-}" "${echo_bold_green-}" "${echo_normal-}"; do
                sleep "${delay}"
                _bash-it-rewind "${len}"
                printf '%b' "${color}${term}"
        done
}

And when I run preview, I get the same output as OP.

 2024-03-01 22:34:43 ⌚  matt-desktop in ~
○ → bash_it preview

        Previewing Bash-it Themes

[test@matt-desktop ~]$ _bash-it-flash-term "${#BASH_IT_THEME}" "${BASH_IT_THEME}"
[test@matt-desktop ~]$ exit

 2024-03-01 22:34:46 ⌚  matt-desktop in ~
○ → 

If I run the command directly with the theme name, the theme name pops up and changes colors a bit, and that's it.

 2024-03-01 22:36:01 ⌚  matt-desktop in ~
○ → _bash-it-flash-term dulcie dulcie
dulcie
 2024-03-01 22:36:06 ⌚  matt-desktop in ~
○ →