Files
System-Sync-Restore/completions/ssr.bash
T
Oliver Surke 51fb589ef2 fix(mackup): safer defaults + recovery after broken symlink sync
- Default-off SSR_MACKUP_PRESYMLINK for DynamicProfiles pre-symlink (was
  risking empty/wrong iCloud trees and breaking iTerm2).
- Remove incorrect skip entries: built-in cfgs use different paths than
  ~/.zsh, ~/.vscode*, ~/.iterm2 — skipping hid real overlap from scan only
  but the presymlink change was the main footgun.
- Add `ssr mackup unlink` → `mackup -f link uninstall` to copy configs back
  from Mackup storage and drop symlinks (official undo).
- Docs: ssr.conf.example, README sync/restore wording, completions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 20:09:23 +02:00

73 lines
2.0 KiB
Bash

# bash completion for ssr — System Sync & Restore.
# Source from your ~/.bashrc or place under ~/.local/share/bash-completion/completions/ssr
_ssr() {
local cur prev words cword
if declare -F _init_completion >/dev/null 2>&1; then
_init_completion || return
else
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
words=("${COMP_WORDS[@]}")
cword=$COMP_CWORD
fi
local commands="install sync restore update schedule config completions status mackup version help"
local global_flags="-c --config -h --help"
# Detect command (first non-flag word after `ssr`).
local cmd=""
local i
for ((i = 1; i < cword; i++)); do
case "${words[i]}" in
-c|--config) ((i++)); continue ;;
-*) continue ;;
*) cmd="${words[i]}"; break ;;
esac
done
# Handle --config <path>.
if [[ "$prev" == "-c" || "$prev" == "--config" ]]; then
COMPREPLY=( $(compgen -f -- "$cur") )
return
fi
# Top-level command selection.
if [[ -z "$cmd" ]]; then
if [[ "$cur" == -* ]]; then
COMPREPLY=( $(compgen -W "$global_flags" -- "$cur") )
else
COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
fi
return
fi
# Per-command argument completion.
case "$cmd" in
restore)
COMPREPLY=( $(compgen -f -- "$cur") )
;;
update)
COMPREPLY=( $(compgen -W "--dry-run -n -h --help" -- "$cur") )
;;
schedule)
COMPREPLY=( $(compgen -W "on off status" -- "$cur") )
;;
config)
COMPREPLY=( $(compgen -W "show edit path" -- "$cur") )
;;
completions)
COMPREPLY=( $(compgen -W "install uninstall status" -- "$cur") )
;;
mackup)
COMPREPLY=( $(compgen -W "scan list clean unlink" -- "$cur") )
;;
*)
COMPREPLY=()
;;
esac
}
complete -F _ssr ssr