PS1 should print the last command duration precisely (https://github.com/Bash-it/bash-it/pull/2119) when properly configurated with the call of the function "duration" in the theme prompt.
Current behavior
The command duration on the PS1 variable does not work in environments that use commas ',' as a decimal point separator instead of a dot.
Possible solution
A possible solution is to set the LC_NUMERIC environment variable as "en_US.UTF-8"
However, this approach does not provide accessibility for users that prefer using commas or different characters as decimal point separators when working with arithmetic in Bash.
Maybe forcing a string substitution on LC_NUMERIC value to dot '.' just before expressions that compute the minutes and seconds in the file: command_duration.bash
Context
It occurred to me when I was configuring my powerline-multiline theme to show the last command duration.
Steps to reproduce
Set up a theme that supports command duration.
Enable command duration by setting the Command duration environment variables in .bashrc
If not set, navigate to your theme, and add the "duration" function to the desired spot in the theme configuration, Ex:
then use the command: source ~/.bashrc or open a new terminal.
#!/usr/bin/env bash
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# Path to the bash it configuration
export BASH_IT="/home/romulo/.bash_it"
# Lock and Load a custom theme file.
# Leave empty to disable theming.
# location /.bash_it/themes/
export BASH_IT_THEME='powerline-multiline'
# Some themes can show whether `sudo` has a current token or not.
# Set `$THEME_CHECK_SUDO` to `true` to check every prompt:
export 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
eval "$(thefuck --alias)"
Expected behavior
PS1 should print the last command duration precisely (https://github.com/Bash-it/bash-it/pull/2119) when properly configurated with the call of the function "duration" in the theme prompt.
Current behavior
The command duration on the PS1 variable does not work in environments that use commas ',' as a decimal point separator instead of a dot.
Possible solution
A possible solution is to set the LC_NUMERIC environment variable as "en_US.UTF-8"
However, this approach does not provide accessibility for users that prefer using commas or different characters as decimal point separators when working with arithmetic in Bash.
Maybe forcing a string substitution on LC_NUMERIC value to dot '.' just before expressions that compute the minutes and seconds in the file: command_duration.bash
Context
It occurred to me when I was configuring my powerline-multiline theme to show the last command duration.
Steps to reproduce
source ~/.bashrc
or open a new terminal.Bash-it version
Version type: dev Current git SHA: 00062bf on 2022-10-13T10:34:57-07:00 Commit info: https://github.com/Bash-it/bash-it/commit/00062bf Compare to latest: https://github.com/Bash-it/bash-it/compare/00062bf...master
List of enabled plugins, themes and aliases
Plugins: base; Aliases: custom, fuck, general; Theme: powerline-multiline
Bash version
5.0.17(1)-release (x86_64-pc-linux-gnu)
Operating system and version
GNU/Linux 5.15.0-52-generic #58~20.04.1-Ubuntu x86_64
bash-it doctor output
❯ 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: custom: Loading component... DEBUG: aliases: custom: Loaded. DEBUG: aliases: fuck: Loading component... DEBUG: aliases: fuck: Loaded. DEBUG: aliases: general: Loading component... DEBUG: aliases: general: Command 'gshuf' does not exist DEBUG: aliases: general: Loaded. DEBUG: plugin: base: Loading component... DEBUG: plugin: base: Command 'markdown' does not exist DEBUG: plugin: base: Loaded. DEBUG: completion: system: Loading component... DEBUG: completion: system: Loaded. DEBUG: completion: bash-it: Loading component... DEBUG: completion: bash-it: Loaded. DEBUG: completion: aliases: Loading component... DEBUG: completion: aliases: Loaded. DEBUG: core: main: Loading theme 'powerline-multiline'. DEBUG: core: main: Loading custom aliases, completion, plugins... DEBUG: core: main: Loading general custom files... DEBUG: custom: checkcpu: Loading custom file... DEBUG: custom: colors: Loading custom file... DEBUG: custom: example: Loading custom file... DEBUG: custom: mediaconversion: Loading custom file... DEBUG: custom: morse: Loading custom file... DEBUG: custom: motd: Loading custom file... DEBUG: custom: xstat: Loading custom file... DEBUG: core: main: Command 'gloobus-preview' does not exist
Your ~/.bashrc
Notes
No response