Add parameter for reset all config

This commit is contained in:
q3aql 2022-06-24 14:19:20 +02:00
parent bce13fc1b6
commit e2b1c494b8
2 changed files with 28 additions and 0 deletions

View File

@ -523,6 +523,7 @@ function pwsh_vault_help() {
echo " $ pwsh-vault-cli --> Run Main CLI" echo " $ pwsh-vault-cli --> Run Main CLI"
echo " $ pwsh-vault-cli --export [--encrypt] --> Export Vault" echo " $ pwsh-vault-cli --export [--encrypt] --> Export Vault"
echo " $ pwsh-vault-cli --import <path-file> --> Import Vault" echo " $ pwsh-vault-cli --import <path-file> --> Import Vault"
echo " $ pwsh-vault-cli --reset --> Delete all settings"
echo " $ pwsh-vault-cli --gen-password [num] --> Generate password" echo " $ pwsh-vault-cli --gen-password [num] --> Generate password"
echo " $ pwsh-vault-cli --help --> Show Help" echo " $ pwsh-vault-cli --help --> Show Help"
echo "" echo ""
@ -1624,6 +1625,15 @@ function search_entries_vault() {
fi fi
} }
function reset_config() {
echo "# All settings will be deleted"
echo -n "# Do you want to continue (Default: n) (y/n): " ; read reset
if [ "${reset}" == "y" ] ; then
rm -rfv ${pwsh_vault}/*
echo "# All settings have been deleted"
fi
}
function pwsh_vault_main() { function pwsh_vault_main() {
vault_main_init=0 vault_main_init=0
while [ ${vault_main_init} -eq 0 ] ;do while [ ${vault_main_init} -eq 0 ] ;do
@ -1686,6 +1696,8 @@ touch ${pwsh_vault_cache_bcard}
touch ${pwsh_vault_cache_temp} touch ${pwsh_vault_cache_temp}
if [ "${1}" == "--help" ] ; then if [ "${1}" == "--help" ] ; then
pwsh_vault_help pwsh_vault_help
elif [ "${1}" == "-h" ] ; then
pwsh_vault_help
elif [ "${1}" == "--export" ] ; then elif [ "${1}" == "--export" ] ; then
if [ "${2}" == "--encrypt" ] ; then if [ "${2}" == "--encrypt" ] ; then
export_pwsh_vault_param_encrypt export_pwsh_vault_param_encrypt
@ -1694,6 +1706,8 @@ elif [ "${1}" == "--export" ] ; then
fi fi
elif [ "${1}" == "--import" ] ; then elif [ "${1}" == "--import" ] ; then
import_pwsh_vault_param "${2}" import_pwsh_vault_param "${2}"
elif [ "${1}" == "--reset" ] ; then
reset_config
elif [ "${1}" == "--gen-password" ] ; then elif [ "${1}" == "--gen-password" ] ; then
if [ -z "${2}" ] ; then if [ -z "${2}" ] ; then
generate_password "20" "param" generate_password "20" "param"

View File

@ -554,6 +554,7 @@ function pwsh_vault_help() {
echo " $ pwsh-vault --> Run Main GUI" echo " $ pwsh-vault --> Run Main GUI"
echo " $ pwsh-vault --export [--encrypt] --> Export Vault" echo " $ pwsh-vault --export [--encrypt] --> Export Vault"
echo " $ pwsh-vault --import <path-file> --> Import Vault" echo " $ pwsh-vault --import <path-file> --> Import Vault"
echo " $ pwsh-vault --reset --> Delete all settings"
echo " $ pwsh-vault --gen-password [num] --> Generate password" echo " $ pwsh-vault --gen-password [num] --> Generate password"
echo " $ pwsh-vault --help --> Show Help" echo " $ pwsh-vault --help --> Show Help"
echo "" echo ""
@ -1352,6 +1353,15 @@ function search_entries_vault() {
fi fi
} }
function reset_config() {
echo "# All settings will be deleted"
echo -n "# Do you want to continue (Default: n) (y/n): " ; read reset
if [ "${reset}" == "y" ] ; then
rm -rfv ${pwsh_vault}/*
echo "# All settings have been deleted"
fi
}
function show_pwsh_vault_main() { function show_pwsh_vault_main() {
echo " Create Entry" echo " Create Entry"
echo " Edit Entry" echo " Edit Entry"
@ -1414,6 +1424,8 @@ touch ${pwsh_vault_cache_temp}
rm -rf ${pwsh_vault_clipboard_copy} rm -rf ${pwsh_vault_clipboard_copy}
if [ "${1}" == "--help" ] ; then if [ "${1}" == "--help" ] ; then
pwsh_vault_help pwsh_vault_help
elif [ "${1}" == "-h" ] ; then
pwsh_vault_help
elif [ "${1}" == "--export" ] ; then elif [ "${1}" == "--export" ] ; then
if [ "${2}" == "--encrypt" ] ; then if [ "${2}" == "--encrypt" ] ; then
export_pwsh_vault_param_encrypt export_pwsh_vault_param_encrypt
@ -1422,6 +1434,8 @@ elif [ "${1}" == "--export" ] ; then
fi fi
elif [ "${1}" == "--import" ] ; then elif [ "${1}" == "--import" ] ; then
import_pwsh_vault_param "${2}" import_pwsh_vault_param "${2}"
elif [ "${1}" == "--reset" ] ; then
reset_config
elif [ "${1}" == "--gen-password" ] ; then elif [ "${1}" == "--gen-password" ] ; then
if [ -z "${2}" ] ; then if [ -z "${2}" ] ; then
generate_password "20" "param" generate_password "20" "param"