addet some snippets
This commit is contained in:
parent
ad33734063
commit
cf3458042f
4 changed files with 30 additions and 13 deletions
4
lua/telesnip/snippets/bash/command_exists.sh
Normal file
4
lua/telesnip/snippets/bash/command_exists.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
# ─< Check if the given command exists silently >─────────────────────────────────────────
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
4
lua/telesnip/snippets/bash/get_ip.sh
Normal file
4
lua/telesnip/snippets/bash/get_ip.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
# ─< get the current ip as a 1 line >─────────────────────────────────────────────────────
|
||||
get_ip() {
|
||||
command ip a | command grep 'inet ' | command grep -v '127.0.0.1' | command awk '{print $2}' | command cut -d/ -f1 | head -n 1
|
||||
}
|
4
lua/telesnip/snippets/bash/info_error.sh
Normal file
4
lua/telesnip/snippets/bash/info_error.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
# ─< Helper functions >─────────────────────────────────────────────────────────────────
|
||||
function echo_error() { echo -e "\033[0;1;31mError: \033[0;31m\t${*}\033[0m"; }
|
||||
function echo_binfo() { echo -e "\033[0;1;34mINFO: \033[0;34m\t${*}\033[0m"; }
|
||||
function echo_info() { echo -e "\033[0;1;35mInfo: \033[0;35m${*}\033[0m"; }
|
Loading…
Add table
Add a link
Reference in a new issue