add git secret cat filename [filename2] feature.

ronn file for manpage
cleanup. Remove -f option.
bump version to 0.2.4
remove unused variable
add references to git secret cat in ronn docs.
git-secret-cat man page
pull/142/head
Josh Rabinowitz 7 years ago
parent c5ed5579f4
commit 612e34cce8

@ -1,6 +1,11 @@
# Changelog
## Version 0.2.4
- Added `git secret cat` feature
## Version 0.2.3
- Added `-m` option to `hide` command, files will only be hidden when modifications are detected (#92)
- Changed how path mappings file works: colon delimited FSDB (#92)
- Fixed `gnupg` >= 2.1 CI tests (#6)
@ -31,7 +36,6 @@
- Refactored `hide` and `clean` commands to be shorter
- `shellcheck` is now supported with `make lint`
## Version 0.2.1
- Now everything is tested inside the `docker`-containers and `OSX` images on `travis`.

@ -0,0 +1,34 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-SECRET\-CAT" "1" "April 2018" "sobolevn" "git-secret"
.
.SH "NAME"
\fBgit\-secret\-cat\fR \- decrypts files passed on command line to stdout
.
.SH "SYNOPSIS"
.
.nf
git secret cat [\-d dir] [\-p password] filename [filenames]
.
.fi
.
.SH "DESCRIPTION"
\fBgit\-secret\-cat\fR \- Outputs to stdout the contents of the files named on the command line by running a \fBgpg \-\-decrypt\fR command\. As with \fBgit\-secret\-reveal\fR, it is important to have paired secret\-key with one of the public\-keys, which were used in the encryption\.
.
.SH "OPTIONS"
.
.nf
\-d \- specifies `\-\-homedir` option for the `gpg`, basically use this option if your store your keys in a custom location\.
\-p \- specifies password for noinput mode, adds `\-\-passphrase` option for `gpg`\.
\-h \- shows help\.
.
.fi
.
.SH "MANUAL"
Run \fBman git\-secret\-cat\fR to see this note\.
.
.SH "SEE ALSO"
git\-secret\-init(1) \fIhttp://git\-secret\.io/git\-secret\-init\fR, git\-secret\-tell(1) \fIhttp://git\-secret\.io/git\-secret\-tell\fR, git\-secret\-add(1) \fIhttp://git\-secret\.io/git\-secret\-add\fR, git\-secret\-hide(1) \fIhttp://git\-secret\.io/git\-secret\-hide\fR, git\-secret\-reveal(1) \fIhttp://git\-secret\.io/git\-secret\-cat\fR

@ -0,0 +1,27 @@
git-secret-cat - decrypts files passed on command line to stdout
=============================================
## SYNOPSIS
git secret cat [-d dir] [-p password] filename [filenames]
## DESCRIPTION
`git-secret-cat` - Outputs to stdout the contents of the files named on the command line by running a `gpg --decrypt` command. As with `git-secret-reveal`, it is important to have paired secret-key with one of the public-keys, which were used in the encryption.
## OPTIONS
-d - specifies `--homedir` option for the `gpg`, basically use this option if your store your keys in a custom location.
-p - specifies password for noinput mode, adds `--passphrase` option for `gpg`.
-h - shows help.
## MANUAL
Run `man git-secret-cat` to see this note.
## SEE ALSO
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-cat)

@ -24,4 +24,4 @@ Run `man git-secret-changes` to see this note.
## SEE ALSO
[git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal)
[git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal), [git-secret-cat(1)](http://git-secret.io/git-secret-cat)

@ -7,7 +7,7 @@ git-secret-hide - encrypts all added files with the inner keyring.
## DESCRIPTION
`git-secret-hide` create an encrypted version for each file added by `git-secret-add` command. Now anyone from the `git-secret`'s keyring can decrypt these files using their secret key.
`git-secret-hide` creates an encrypted version for each file added by `git-secret-add` command. Now anyone from the `git-secret`'s keyring can decrypt these files using their secret key.
It is possible to modify the names of the encrypted files by setting `SECRETS_EXTENSION` variable.
@ -28,4 +28,4 @@ Run `man git-secret-hide` to see this note.
## SEE ALSO
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal)
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal), [git-secret-cat(1)](http://git-secret.io/git-secret-cat)

@ -22,4 +22,4 @@ Run `man git-secret-list` to see this note.
## SEE ALSO
[git-secret-whoknows(1)](http://git-secret.io/git-secret-whoknows), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-remove(1)](http://git-secret.io/git-secret-remove), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal)
[git-secret-whoknows(1)](http://git-secret.io/git-secret-whoknows), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-remove(1)](http://git-secret.io/git-secret-remove), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal), [git-secret-cat(1)](http://git-secret.io/git-secret-cat)

@ -7,7 +7,7 @@ git-secret-reveal - decrypts all added files.
## DESCRIPTION
`git-secret-reveal` - decrypts all the files in the `.gitsecret/paths/mapping.cfg` by running a `gpg --decrypt` command. It is important to have paired secret-key with one of the public-keys, which were used in the encryption.
`git-secret-reveal` - decrypts all the files in the `.gitsecret/paths/mapping.cfg` by running a `gpg --decrypt` command. It is important to have paired secret-key with one of the public-keys which were used in the encryption.
## OPTIONS
@ -25,4 +25,4 @@ Run `man git-secret-reveal` to see this note.
## SEE ALSO
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-hide(1)](http://git-secret.io/git-secret-hide)
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-cat(1)](http://git-secret.io/git-secret-cat), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-hide(1)](http://git-secret.io/git-secret-hide)

@ -26,4 +26,4 @@ Run `man git-secret-tell` to see this note.
## SEE ALSO
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal), [git-secret-killperson(1)](http://git-secret.io/git-secret-killperson)
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal), [git-secret-cat(1)](http://git-secret.io/git-secret-cat), [git-secret-killperson(1)](http://git-secret.io/git-secret-killperson)

@ -22,4 +22,4 @@ Run `man git-secret-usage` to see this note.
## SEE ALSO
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal)
[git-secret-init(1)](http://git-secret.io/git-secret-init), [git-secret-add(1)](http://git-secret.io/git-secret-add), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal), [git-secret-cat(1)](http://git-secret.io/git-secret-cat)

@ -22,4 +22,4 @@ Run `man git-secret-whoknows` to see this note.
## SEE ALSO
[git-secret-list(1)](http://git-secret.io/git-secret-list), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal)
[git-secret-list(1)](http://git-secret.io/git-secret-list), [git-secret-tell(1)](http://git-secret.io/git-secret-tell), [git-secret-hide(1)](http://git-secret.io/git-secret-hide), [git-secret-reveal(1)](http://git-secret.io/git-secret-reveal), [git-secret-cat(1)](http://git-secret.io/git-secret-cat)

@ -0,0 +1,43 @@
#!/usr/bin/env bash
function cat {
local homedir=''
local passphrase=''
OPTIND=1
while getopts 'hfd:p:' opt; do
case "$opt" in
h) _show_manual_for 'cat';;
p) passphrase=$OPTARG;;
d) homedir=$OPTARG;;
*) _invalid_option_for 'cat';;
esac
done
shift $((OPTIND-1))
[ "$1" = '--' ] && shift
_user_required
# Command logic:
#local path_mappings
#path_mappings=$(_get_secrets_dir_paths_mapping)
for line in "$@"
do
local filename
local path
#echo $line
filename=$(_get_record_filename "$line")
path=$(_append_root_path "$filename")
# The parameters are: filename, write-to-file, force, homedir, passphrase
_decrypt "$path" "0" "0" "$homedir" "$passphrase"
done
}

@ -19,7 +19,7 @@ function usage {
# to the old dynamic-loading version of this code.
# thanks to @antmak it is now fixed, see:
# https://github.com/sobolevn/git-secret/issues/47
local commands="add|changes|clean|hide|init|killperson|list|remove|reveal|tell|usage|whoknows"
local commands="add|cat|changes|clean|hide|init|killperson|list|remove|reveal|tell|usage|whoknows"
echo "usage: git secret [$commands]"
}

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck disable=2034
GITSECRET_VERSION='0.2.3'
GITSECRET_VERSION='0.2.4'

Loading…
Cancel
Save