mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 01:10:12 -08:00
- backup-env-files.sh: Main backup script with Gitea integration - validate-env-backups.sh: Validation and integrity checking - env-backup-integration.sh: Integration with existing backup system - completions/env-backup-completion.bash: Tab completion support - docs/env-backup-system.md: Documentation for the backup system These scripts provide secure backup of .env files to private Gitea repository.
51 lines
1.4 KiB
Bash
51 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
# env-backup-completion.bash - Bash completion for environment backup scripts
|
|
# Source this file or copy to ~/.local/share/bash-completion/completions/
|
|
|
|
_backup_env_files() {
|
|
local cur prev opts
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
opts="--help --init --force --dry-run --restore --list --gitea-url --username"
|
|
|
|
case ${prev} in
|
|
--gitea-url|-g)
|
|
# Suggest common gitea URL patterns
|
|
COMPREPLY=( $(compgen -W "https://git. https://gitea. https://code." -- ${cur}) )
|
|
return 0
|
|
;;
|
|
--username|-u)
|
|
# No completion for username
|
|
return 0
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
return 0
|
|
}
|
|
|
|
_validate_env_backups() {
|
|
local cur prev opts
|
|
COMPREPLY=()
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
|
|
opts="--help --verbose --summary-only --missing-only --diff"
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
return 0
|
|
}
|
|
|
|
# Register completion functions
|
|
complete -F _backup_env_files backup-env-files.sh
|
|
complete -F _validate_env_backups validate-env-backups.sh
|
|
|
|
# Also register for the full path versions
|
|
complete -F _backup_env_files ./backup-env-files.sh
|
|
complete -F _validate_env_backups ./validate-env-backups.sh
|