addet plugin telesnip and some other changes
This commit is contained in:
parent
84adb02beb
commit
ad33734063
9 changed files with 258 additions and 161 deletions
15
lua/telesnip/snippets/bash/check_root.sh
Normal file
15
lua/telesnip/snippets/bash/check_root.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Check if the user is root and set sudo variable if necessary
|
||||
check_root() {
|
||||
if [[ "${EUID}" -ne 0 ]]; then
|
||||
if command_exists sudo; then
|
||||
echo_binfo "User is not root. Using sudo for privileged operations."
|
||||
_sudo="sudo"
|
||||
else
|
||||
echo_error "No sudo found and you're not root! Can't install packages."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo_binfo "Root access confirmed."
|
||||
_sudo=""
|
||||
fi
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue