#!/usr/bin/env bash

username=$1
home_dir={{component.home}}/$username

read -p "Are you sure, you want to delete $home_dir with all contents? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
  rm -rf $home_dir
  ftpasswd --passwd \
    --delete-user \
    --file={{component.passwd_file.path}} \
    --name=$username
fi
