1
Fork 0
mirror of https://github.com/RGBCube/agenix synced 2025-07-30 02:07:44 +00:00

feature: pipe cleartext into agenix -e

If STDIN is not interactive, change EDITOR to `cp /dev/stdin`.

fixes #33
This commit is contained in:
Ryan Mulligan 2023-02-19 10:20:07 -08:00
parent 2c56a93426
commit 344c8e41d2
3 changed files with 17 additions and 8 deletions

View file

@ -23,6 +23,8 @@ function show_help () {
echo ' '
echo 'EDITOR environment variable of editor to use when editing FILE'
echo ' '
echo 'If STDIN is not interactive, EDITOR will be set to "cp /dev/stdin"'
echo ' '
echo 'RULES environment variable with path to Nix file specifying recipient public keys.'
echo "Defaults to './secrets.nix'"
echo ' '
@ -124,6 +126,8 @@ function edit {
cp "$CLEARTEXT_FILE" "$CLEARTEXT_FILE.before"
fi
[ -t 0 ] || EDITOR='cp /dev/stdin'
$EDITOR "$CLEARTEXT_FILE"
if [ ! -f "$CLEARTEXT_FILE" ]