mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-06 10:59:22 +00:00
- Add dependency check for age and curl with install instructions - Add --delete flag to remove originals after encryption - Add -f/--force flag to control overwrite behavior - Skip already-encrypted .age files during encryption - Include hidden files (dotglob) when encrypting directories - Handle empty directories gracefully with nullglob - Allow flags in any position (proper option parsing) - Add set -euo pipefail for better error handling - Update documentation with all features and examples - Bump version to 1.1.0
1.7 KiB
1.7 KiB
a
Encrypt or decrypt files and directories using age and your GitHub SSH keys.
Requirements
- age - encryption tool
- curl - for fetching SSH keys
Install age:
brew install age # macOS
apt install age # Debian/Ubuntu
dnf install age # Fedora
Usage
a [options] <command> <file|directory>
Commands:
e,enc,encrypt- encrypt filesd,dec,decrypt- decrypt fileshelp,--help,-h- show helpversion,--version- show version
Options:
-v,--verbose- show log output--delete- delete original files after successful operation-f,--force- overwrite existing output files
Environment variables:
AGE_KEYSFILE- location of the keys file (default:~/.ssh/keys.txt)AGE_KEYSSOURCE- URL to fetch keys if missing (default: GitHub keys)AGE_LOGFILE- log file path (default:~/.cache/a.log)
Examples
# Encrypt a file
a encrypt secret.txt
# Encrypt with short command
a e secret.txt
# Decrypt a file
a decrypt secret.txt.age
a d secret.txt.age
# Encrypt a directory (includes hidden files)
a e /path/to/secrets/
# Encrypt and delete originals
a --delete e secret.txt
# Force overwrite existing .age file
a -f e secret.txt
# Verbose output
a -v e secret.txt
Behavior
- Encrypting a directory processes all files recursively, including hidden files
- Already encrypted files (
.age) are skipped during encryption - Only
.agefiles are processed during directory decryption - Original files are preserved by default (use
--deleteto remove them) - Output files are not overwritten by default (use
--forceto overwrite)