mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-22 11:56:00 +00:00
feat(tools): moved x-dc & few others to shared.sh
This commit is contained in:
25
base/zshrc
25
base/zshrc
@@ -13,6 +13,19 @@ export DOTFILES="$HOME/.dotfiles"
|
|||||||
# shellcheck source=shared.sh
|
# shellcheck source=shared.sh
|
||||||
source "$DOTFILES/scripts/shared.sh"
|
source "$DOTFILES/scripts/shared.sh"
|
||||||
|
|
||||||
|
# Run x-load-configs in your terminal to reload the files.
|
||||||
|
function x-load-configs()
|
||||||
|
{
|
||||||
|
# Load the shell dotfiles, and then some:
|
||||||
|
for file in $DOTFILES/config/{exports,alias,functions}; do
|
||||||
|
[ -r "$file" ] && source "$file"
|
||||||
|
[ -r "$file-secret" ] && source "$file-secret"
|
||||||
|
[ -r "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
||||||
|
[ -r "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
x-load-configs
|
||||||
|
|
||||||
export HISTFILE="$XDG_STATE_HOME"/zsh/history
|
export HISTFILE="$XDG_STATE_HOME"/zsh/history
|
||||||
|
|
||||||
autoload -U colors zsh/terminfo
|
autoload -U colors zsh/terminfo
|
||||||
@@ -33,18 +46,6 @@ then
|
|||||||
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run x-load-configs in your terminal to reload the files.
|
|
||||||
function x-load-configs()
|
|
||||||
{
|
|
||||||
# Load the shell dotfiles, and then some:
|
|
||||||
for file in $DOTFILES/config/{exports,alias,functions}; do
|
|
||||||
[ -r "$file" ] && source "$file"
|
|
||||||
[ -r "$file-secret" ] && source "$file-secret"
|
|
||||||
[ -r "$file-$HOSTNAME" ] && source "$file-$HOSTNAME"
|
|
||||||
[ -r "$file-$HOSTNAME-secret" ] && source "$file-$HOSTNAME-secret"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
x-load-configs
|
|
||||||
|
|
||||||
# Import ssh keys in keychain
|
# Import ssh keys in keychain
|
||||||
ssh-add -A 2>/dev/null;
|
ssh-add -A 2>/dev/null;
|
||||||
|
|||||||
@@ -20,12 +20,6 @@ ssh-docker()
|
|||||||
docker exec -it "$@" bash
|
docker exec -it "$@" bash
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a new directory and enter it
|
|
||||||
mkd()
|
|
||||||
{
|
|
||||||
mkdir -p "$@" && cd "$@" || exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# All the dig info
|
# All the dig info
|
||||||
digga()
|
digga()
|
||||||
{
|
{
|
||||||
@@ -64,24 +58,6 @@ scheduler()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
silent()
|
|
||||||
{
|
|
||||||
"$@" >&/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
ask()
|
|
||||||
{
|
|
||||||
while true; do
|
|
||||||
read -p "$1 ([y]/n) " -r
|
|
||||||
REPLY=${REPLY:-"y"}
|
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
return 1
|
|
||||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Defines default antigen bundles
|
# Defines default antigen bundles
|
||||||
x-default-antigen-bundles()
|
x-default-antigen-bundles()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Verify folder exists, and if it does not, create it.
|
|
||||||
|
|
||||||
dir="$1"
|
|
||||||
|
|
||||||
[ $# -eq 0 ] && {
|
|
||||||
echo "Usage: $0 full/path/to/dir/to/create"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ ! -d "$dir" ]; then
|
|
||||||
mkdir -p "$dir" && exit 0
|
|
||||||
fi
|
|
||||||
@@ -294,3 +294,46 @@ function replacable()
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create directory if it doesn't exist already
|
||||||
|
x-dc()
|
||||||
|
{
|
||||||
|
dir="$1"
|
||||||
|
|
||||||
|
[ $# -eq 0 ] && {
|
||||||
|
echo "Usage: $0 full/path/to/dir/to/create"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -d "$dir" ]; then
|
||||||
|
mkdir -p "$dir" && exit 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a new directory and enter it
|
||||||
|
mkd()
|
||||||
|
{
|
||||||
|
mkdir -p "$@" && cd "$@" || exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run command silently
|
||||||
|
# Usage: silent uptime
|
||||||
|
silent()
|
||||||
|
{
|
||||||
|
"$@" >&/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a prompt which you have to answer y/n to continue
|
||||||
|
ask()
|
||||||
|
{
|
||||||
|
while true; do
|
||||||
|
read -p "$1 ([y]/n) " -r
|
||||||
|
REPLY=${REPLY:-"y"}
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
return 1
|
||||||
|
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user