51fb589ef2
- 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>
76 lines
2.8 KiB
Plaintext
76 lines
2.8 KiB
Plaintext
#compdef ssr
|
|
# zsh completion for ssr — System Sync & Restore.
|
|
# Install: copy or symlink into a directory on $fpath, then `autoload -Uz _ssr`.
|
|
|
|
_ssr() {
|
|
local context state line
|
|
typeset -A opt_args
|
|
|
|
local -a commands=(
|
|
'install:First-time install (link binary, seed config, schedule sync)'
|
|
'sync:Run a backup → cloud'
|
|
'restore:Restore a machine (defaults to cloud Brewfile)'
|
|
'update:Pull latest ssr code, refresh launchd if needed'
|
|
'schedule:Manage the scheduled launchd sync job'
|
|
'config:Show or edit the active config file'
|
|
'completions:Install or remove shell completions'
|
|
'status:Show last sync time, cloud target, schedule state'
|
|
'mackup:Manage auto-generated Mackup app definitions'
|
|
'version:Print version'
|
|
'help:Show top-level help'
|
|
)
|
|
|
|
_arguments -C \
|
|
'(-h --help)'{-h,--help}'[Show help]' \
|
|
'(-c --config)'{-c,--config}'[Use a specific config file]:path:_files' \
|
|
'1: :->cmd' \
|
|
'*::arg:->args'
|
|
|
|
case "$state" in
|
|
cmd)
|
|
_describe -t commands 'ssr command' commands
|
|
;;
|
|
args)
|
|
case "${line[1]}" in
|
|
restore)
|
|
_arguments \
|
|
'(-h --help)'{-h,--help}'[Show help]' \
|
|
'1:Brewfile:_files'
|
|
;;
|
|
update)
|
|
_arguments \
|
|
'(-h --help)'{-h,--help}'[Show help]' \
|
|
'(-n --dry-run)'{-n,--dry-run}'[Preview without pulling]'
|
|
;;
|
|
schedule)
|
|
_values 'schedule action' \
|
|
'on[Enable scheduled sync]' \
|
|
'off[Disable scheduled sync]' \
|
|
'status[Show schedule state]'
|
|
;;
|
|
config)
|
|
_values 'config action' \
|
|
'show[Print active config]' \
|
|
'edit[Open config in $EDITOR]' \
|
|
'path[Print config path]'
|
|
;;
|
|
completions)
|
|
_values 'completions action' \
|
|
'install[Install shell completions]' \
|
|
'uninstall[Remove shell completions]' \
|
|
'status[Show installed completions]'
|
|
;;
|
|
mackup)
|
|
_values 'mackup action' \
|
|
'scan[Suggest and confirm ssr-*.cfg files]' \
|
|
'list[List generated ssr-*.cfg files]' \
|
|
'clean[Remove all generated ssr-*.cfg files]' \
|
|
'unlink[mackup link uninstall — revert symlinks]'
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
}
|
|
|
|
_ssr "$@"
|