Check if exists entry with creating new entry section

This commit is contained in:
q3aql 2022-07-01 19:06:40 +02:00
parent d561d82ff8
commit 551e36bb84
3 changed files with 54 additions and 0 deletions

View File

@ -219,6 +219,15 @@ function create_login_vault_entry() {
echo -n "# Enter Name for Login Entry: " ; read name_entry
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/logins/${name_entry}" ] ; then
echo ""
echo "# Vault logins/${name_entry} already exists"
echo "# You can remove or edit it"
echo ""
echo -n "# Press enter key to continue " ; read enter_continue
new_entry=""
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/logins/${name_entry}"
name_login_entry=1
fi
@ -306,6 +315,15 @@ function create_bcard_vault_entry() {
echo -n "# Enter Name for Bcard Entry: " ; read name_entry
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/bcard/${name_entry}" ] ; then
echo ""
echo "# Vault bcard/${name_entry} already exists"
echo "# You can remove or edit it."
echo ""
echo -n "# Press enter key to continue " ; read enter_continue
new_entry=""
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/bcard/${name_entry}"
name_bcard_entry=1
fi
@ -387,6 +405,15 @@ function create_note_vault_entry() {
echo -n "# Enter Name for Note Entry: " ; read name_entry
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/notes/${name_entry}" ] ; then
echo ""
echo "# Vault notes/${name_entry} already exists"
echo "# You can remove or edit it."
echo ""
echo -n "# Press enter key to continue " ; read enter_continue
new_entry=""
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/notes/${name_entry}"
name_note_entry=1
fi

View File

@ -254,6 +254,11 @@ function create_login_vault_entry() {
name_entry=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Name for Login Entry:" 0 0)
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/logins/${name_entry}" ] ; then
dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
--msgbox "# Vault logins/${name_entry} already exists\n# You can remove or edit it." 0 0
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/logins/${name_entry}"
name_login_entry=1
fi
@ -337,6 +342,11 @@ function create_bcard_vault_entry() {
name_entry=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Name for Bcard Entry:" 0 0)
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/bcard/${name_entry}" ] ; then
dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
--msgbox "# Vault bcard/${name_entry} already exists\n# You can remove or edit it." 0 0
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/bcard/${name_entry}"
name_bcard_entry=1
fi
@ -412,6 +422,11 @@ function create_note_vault_entry() {
name_entry=$(dialog --stdout --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" --inputbox "# Enter Name for Note Entry:" 0 0)
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/notes/${name_entry}" ] ; then
dialog --title "# pwsh-vault-dl ${VERSION} $(generate_spaces 20)" \
--msgbox "# Vault notes/${name_entry} already exists\n# You can remove or edit it." 0 0
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/notes/${name_entry}"
name_note_entry=1
fi

View File

@ -282,6 +282,10 @@ function create_login_vault_entry() {
name_entry=$(echo > /dev/null | pwsh-vaultm -p "爵 Enter Name for Login Entry:")
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/logins/${name_entry}" ] ; then
echo > /dev/null | pwsh-vaultm -p "爵 Vault logins/${name_entry} already exists $(generate_spaces 55)"
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/logins/${name_entry}"
name_login_entry=1
fi
@ -352,6 +356,10 @@ function create_bcard_vault_entry() {
name_entry=$(echo > /dev/null | pwsh-vaultm -p " Enter Name for Bcard Entry:")
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/bcard/${name_entry}" ] ; then
echo > /dev/null | pwsh-vaultm -p " Vault bcard/${name_entry} already exists $(generate_spaces 55)"
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/bcard/${name_entry}"
name_bcard_entry=1
fi
@ -415,6 +423,10 @@ function create_note_vault_entry() {
name_entry=$(echo > /dev/null | pwsh-vaultm -p " Enter Name for Note Entry:")
if [ ! -z "${name_entry}" ] ; then
name_entry=$(removeSpaces "${name_entry}")
if [ -d "${pwsh_vault}/notes/${name_entry}" ] ; then
echo > /dev/null | pwsh-vaultm -p " Vault notes/${name_entry} already exists $(generate_spaces 55)"
pwsh_vault_main
fi
mkdir -p "${pwsh_vault}/notes/${name_entry}"
name_note_entry=1
fi