You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
git-secret/src/commands/git_secret_cat.sh

41 lines
752 B
Bash

#!/usr/bin/env bash
function cat {
local homedir=''
local passphrase=''
OPTIND=1
while getopts 'hd:p:' opt; do
case "$opt" in
h) _show_manual_for 'cat';;
p) passphrase=$OPTARG;;
d) homedir=$(_clean_windows_path "$OPTARG");;
*) _invalid_option_for 'cat';;
esac
done
shift $((OPTIND-1))
[ "$1" = '--' ] && shift
_user_required
# Command logic:
for line in "$@"
do
local filename
local path
filename=$(_get_record_filename "$line")
path=$(_prepend_relative_root_path "$filename") # this uses the _relative version because of #710
# The parameters are: filename, write-to-file, force, homedir, passphrase
_decrypt "$path" "0" "0" "$homedir" "$passphrase"
done
}