Compare commits
3 Commits
5f8997f418
...
6f7aec9147
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f7aec9147 | ||
|
|
c4a93c7647 | ||
|
|
8d98936961 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
|||||||
[submodule "3rd-party/complete-alias"]
|
[submodule "3rd-party/complete-alias"]
|
||||||
path = 3rd-party/complete-alias
|
path = 3rd-party/complete-alias
|
||||||
url = https://github.com/cykerway/complete-alias.git
|
url = https://github.com/cykerway/complete-alias.git
|
||||||
|
[submodule "3rd-party/junegunn/fzf-git.sh"]
|
||||||
|
path = 3rd-party/junegunn/fzf-git.sh
|
||||||
|
url = https://github.com/junegunn/fzf-git.sh
|
||||||
|
|||||||
1
3rd-party/junegunn/fzf-git.sh
vendored
Submodule
1
3rd-party/junegunn/fzf-git.sh
vendored
Submodule
Submodule 3rd-party/junegunn/fzf-git.sh added at c823ffd521
1
bashrc
1
bashrc
@@ -28,6 +28,7 @@ _source_dir_files "${BASEDIR}"/libs
|
|||||||
|
|
||||||
# Source 3rd party libs if they exists
|
# Source 3rd party libs if they exists
|
||||||
_source_file_if_exists "${BASEDIR}/3rd-party/complete-alias/complete_alias"
|
_source_file_if_exists "${BASEDIR}/3rd-party/complete-alias/complete_alias"
|
||||||
|
_source_file_if_exists "${BASEDIR}/3rd-party/junegunn/fzf-git.sh/fzf-git.sh"
|
||||||
|
|
||||||
# Early customization
|
# Early customization
|
||||||
_source_dir_files "${BASEDIR}"/rc.before.d
|
_source_dir_files "${BASEDIR}"/rc.before.d
|
||||||
|
|||||||
@@ -58,11 +58,23 @@ function echo_reverse { echo -e "\e[7m${*}\e[0m"; }
|
|||||||
function echo_concealed { echo -e "\e[8m${*}\e[0m"; }
|
function echo_concealed { echo -e "\e[8m${*}\e[0m"; }
|
||||||
|
|
||||||
# Affiche un message informatif stylisé sur la sortie d'erreur
|
# Affiche un message informatif stylisé sur la sortie d'erreur
|
||||||
function echo_info { >&2 echo -e "\e[00;34;49m ${*}\e[39;49;00m"; }
|
function echo_info { >&2 echo -e "\e[00;34;49m ${*}\e[39;49;00m"; }
|
||||||
function echo_warning { >&2 echo -e "\e[00;33;49m ${*}\e[39;49;00m"; }
|
function echo_warning { >&2 echo -e "\e[00;33;49m ${*}\e[39;49;00m"; }
|
||||||
function echo_error { >&2 echo -e "\e[00;01;31;49m ${*}\e[39;49;00m"; }
|
function echo_error { >&2 echo -e "\e[00;01;31;49m ${*}\e[39;49;00m"; }
|
||||||
function echo_success { >&2 echo -e "\e[00;01;32;49m ${*}\e[39;49;00m"; }
|
function echo_success { >&2 echo -e "\e[00;01;32;49m ${*}\e[39;49;00m"; }
|
||||||
function echo_failed { >&2 echo -e "\e[00;01;31;49m✖ ${*}\e[39;49;00m"; }
|
function echo_failed { >&2 echo -e "\e[00;01;31;49m✖ ${*}\e[39;49;00m"; }
|
||||||
|
|
||||||
|
function echo_verbose {
|
||||||
|
if [ -n "${VERBOSE}" ]; then
|
||||||
|
echo_faint "${*}" >&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function echo_debug {
|
||||||
|
if [ -n "${DEBUG}" ]; then
|
||||||
|
echo_faint "🐛 ${*}" >&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function echo_demo {
|
function echo_demo {
|
||||||
echo_bold bold
|
echo_bold bold
|
||||||
@@ -77,4 +89,5 @@ function echo_demo {
|
|||||||
echo_error error
|
echo_error error
|
||||||
echo_success success
|
echo_success success
|
||||||
echo_failed failed
|
echo_failed failed
|
||||||
|
DEBUG=true echo_debug debug
|
||||||
}
|
}
|
||||||
|
|||||||
49
rc.d/terminal-title
Normal file
49
rc.d/terminal-title
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Function to update terminal/tmux title
|
||||||
|
_update_terminal_title() {
|
||||||
|
local kubecontext dir gitrepo gitremote icon title
|
||||||
|
|
||||||
|
# Detect Kubernetes context (if kubectl is available)
|
||||||
|
if [ -n "${KUBECONFIG}" ]; then
|
||||||
|
if command -v kubectl >/dev/null 2>&1; then
|
||||||
|
kubecontext=$(kubectl config current-context 2>/dev/null)
|
||||||
|
if [ -n "$kubecontext" ]; then
|
||||||
|
title=" ${kubecontext}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If no title is already set, check if we're in $HOME
|
||||||
|
if [ -z "${title}" ] && [ "$PWD" = "$HOME" ]; then
|
||||||
|
title=" ~"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If we're in a git repo display repo name with a nice icon
|
||||||
|
if [ -z "${title}" ] && gitrepo=$(git rev-parse --show-toplevel 2>/dev/null); then
|
||||||
|
dir=$(basename "${gitrepo}")
|
||||||
|
|
||||||
|
# Detect host from remote URL
|
||||||
|
gitremote=$(git remote get-url origin 2>/dev/null)
|
||||||
|
case "${gitremote}" in
|
||||||
|
*github.com*) icon="" ;; # nf-fa-github
|
||||||
|
*gitlab.com*) icon="" ;; # nf-fa-gitlab
|
||||||
|
*gitea*) icon="" ;; # nf-linux-gitea
|
||||||
|
*) icon="" ;; # nf-dev-git
|
||||||
|
esac
|
||||||
|
|
||||||
|
title="${icon} ${dir}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the title in tmux or terminal window
|
||||||
|
if [ -n "${title}" ]; then
|
||||||
|
if [ -n "$TMUX" ]; then
|
||||||
|
tmux rename-window "${title}"
|
||||||
|
else
|
||||||
|
printf '\033]0;%s\007' "${title}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add the function to the PROMPT_COMMAND variable to have regular updates
|
||||||
|
if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_terminal_title"; fi
|
||||||
Reference in New Issue
Block a user