mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2024-11-22 09:26:32 +00:00
Prompt: Hide host if not on ssh
Updates for fish/zsh/bash
This commit is contained in:
parent
a49c22116c
commit
51f843716b
@ -45,7 +45,14 @@ function ps_force_target {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ps_host_name {
|
function ps_host_name {
|
||||||
[ -z "$TMUX" ] || return && echo '\h '
|
# Returns hostname if on remote host and not using tmux
|
||||||
|
# Check if we're on a non-local host via ssh
|
||||||
|
if [ -n "$SSH_CLIENT" ] && [ -n "$SSH_TTY" ]; then
|
||||||
|
# Check if we're using tmux, since tmux status line displays the host
|
||||||
|
if [ -z "$TMUX" ]; then
|
||||||
|
echo '\h '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ps_virtual_env {
|
function ps_virtual_env {
|
||||||
|
@ -83,7 +83,14 @@ fi
|
|||||||
# Set prompt to include some useful information
|
# Set prompt to include some useful information
|
||||||
|
|
||||||
function ps_host_name {
|
function ps_host_name {
|
||||||
[ -z "$TMUX" ] || return && echo "$(hostname) "
|
# Returns hostname if on remote host and not using tmux
|
||||||
|
# Check if we're on a non-local host via ssh
|
||||||
|
if [ -n "$SSH_CLIENT" ] && [ -n "$SSH_TTY" ]; then
|
||||||
|
# Check if we're using tmux, since tmux status line displays the host
|
||||||
|
if [ -z "$TMUX" ]; then
|
||||||
|
echo "$(hostname) "
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ps_git_branch {
|
function ps_git_branch {
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# name: ifij (forked from RobbyRussel)
|
# name: ifij (forked from RobbyRussel)
|
||||||
|
# description: prompt containing minimal relevant information with host, path,
|
||||||
|
# and git status.
|
||||||
|
|
||||||
function _status_color
|
function _status_color
|
||||||
# Returns a color for successful or failed previous command
|
# Returns a color for successful or failed previous command
|
||||||
@ -10,11 +12,15 @@ function _status_color
|
|||||||
end
|
end
|
||||||
|
|
||||||
function _hostname
|
function _hostname
|
||||||
# Returns the hostname if not using tmux since tmux will display
|
# Returns hostname if on remote host and not using tmux
|
||||||
if [ -z $TMUX ]
|
# Check if we're on a non-local host via ssh
|
||||||
|
if set -q SSH_CLIENT; or set -q SSH_TTY
|
||||||
|
# Check if we're using tmux, since tmux status line displays the host
|
||||||
|
if not set -q TMUX
|
||||||
echo (hostname -s)" "
|
echo (hostname -s)" "
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function _prompt_char
|
function _prompt_char
|
||||||
# Gives a colored prompt char for user or root
|
# Gives a colored prompt char for user or root
|
||||||
|
Loading…
Reference in New Issue
Block a user