Add `crypt` subcommand to migrate from outside the subdirectory

This commit is contained in:
Peter Cai 2022-10-10 14:50:06 -04:00
parent cc36d53933
commit c9c4f16860
1 changed files with 17 additions and 0 deletions

View File

@ -79,6 +79,14 @@ gocrypt_delegate() {
pass git commit -m "Encrypted pass operation inside gocrypt" "$gocrypt_dir" || echo "No git commit created"
}
gocrypt_crypt() {
gocrypt_open_check
[ ! -f "$1.gpg" ] && gocrypt_die "Not found: $1"
cmd_show "$1" | EDITOR=tee gocrypt_delegate edit "$1"
cmd_delete -f "$1"
echo "Moved $1 into encrypted storage"
}
gocrypt_help() {
printf "%s" "\
$PROGRAM gocrypt - hide part of the password store in a subdirectory encrypted with gocryptfs
@ -100,6 +108,11 @@ usage
$PROGRAM gocrypt close
Unmount the encrypted subtree, if it was opened before.
$PROGRAM gocrypt crypt <pass_name>
Move a password <pass_name> from the original password store to the encrypted subdirectory. Note
that if you use git, this will still leave a record in the git repository of the original password
store.
$PROGRAM gocrypt help
Print this help message.
@ -145,6 +158,10 @@ case "$1" in
shift
gocrypt_open $@
;;
crypt)
shift
gocrypt_crypt $@
;;
close)
shift
gocrypt_close $@