chore: shfmt, cleanup

This commit is contained in:
2024-12-28 18:59:09 +02:00
parent eb91a43bbd
commit a8a473a46d
26 changed files with 299 additions and 516 deletions

View File

@@ -6,17 +6,18 @@ KEYS_FILE="${AGE_KEYSFILE:-$HOME/.ssh/keys.txt}"
KEYS_SOURCE="${AGE_KEYSSOURCE:-https://github.com/ivuorinen.keys}"
# Check for required commands
if ! command -v age &>/dev/null; then
if ! command -v age &> /dev/null; then
echo "Error: age is not installed. Please install it to continue."
exit 1
fi
if ! command -v curl &>/dev/null; then
if ! command -v curl &> /dev/null; then
echo "Error: curl is not installed. Please install it to continue."
exit 1
fi
# Ensure a file is provided
# shellcheck disable=SC2181
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <file-to-encrypt>"
exit 1
@@ -50,7 +51,7 @@ fi
# Encrypt the file
OUTPUT_FILE="${FILE}.age"
age -R "$KEYS_FILE" "$FILE" >"$OUTPUT_FILE"
age -R "$KEYS_FILE" "$FILE" > "$OUTPUT_FILE"
if [[ $? -eq 0 ]]; then
echo "File encrypted successfully: $OUTPUT_FILE"