dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 715433680615ca441652e140f1740d671f36a154
parent 590c77ff7bd5c572f5acae7991b147f622b2a2dc
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Tue,  5 Mar 2019 18:33:55 +0100

Script to import text files into pass


Former-commit-id: 0bc2dc7b9e8234f65a90259923be9f5dac142673
Diffstat:
Ascripts/pass-import-txt | 26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/scripts/pass-import-txt b/scripts/pass-import-txt @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +if [ $# -ne 2 ]; then + echo 'Usage: pass-import-txt [file] [path]' + exit 1 +fi + +dest="${2%/}" +echo "$(tput setaf 6)This is what's gonna happen:" +while read -r line; do + arr=(${line//:/ }); + echo "echo ${arr[1]} | pass insert --multiline $dest/${arr[0]}"; +done < "$1" + +echo -ne "\n$(tput setaf 3)Is this OK? [Y/n]" +read -rn 1 -s CONF +case $CONF in + Y|y) + echo -e "\n$(tput setaf 6)OK, importing...$(tput sgr0)" + ;; + *) exit 1;; +esac +while read -r line; do + arr=(${line//:/ }); + echo "${arr[1]}" | pass insert --multiline "$dest"/"${arr[0]}"; +done < "$1" +echo "$(tput setaf 2)Done."