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>
74 lines
2.7 KiB
Fish
74 lines
2.7 KiB
Fish
# fish completion for ssr — System Sync & Restore.
|
|
# Install: drop into ~/.config/fish/completions/ssr.fish
|
|
|
|
set -l ssr_cmds install sync restore update schedule config completions status mackup version help
|
|
|
|
# True when no subcommand has been picked yet (only flags / option-args seen so far).
|
|
function __ssr_needs_subcmd
|
|
set -l tokens (commandline -opc)
|
|
set -l skip_next 0
|
|
for tok in $tokens[2..-1]
|
|
if test $skip_next -eq 1
|
|
set skip_next 0
|
|
continue
|
|
end
|
|
switch $tok
|
|
case -c --config
|
|
set skip_next 1
|
|
case '-*'
|
|
# ignore other flags
|
|
case '*'
|
|
return 1
|
|
end
|
|
end
|
|
return 0
|
|
end
|
|
|
|
# True when the chosen subcommand equals $argv[1].
|
|
function __ssr_using_subcmd
|
|
set -l target $argv[1]
|
|
set -l tokens (commandline -opc)
|
|
set -l skip_next 0
|
|
for tok in $tokens[2..-1]
|
|
if test $skip_next -eq 1
|
|
set skip_next 0
|
|
continue
|
|
end
|
|
switch $tok
|
|
case -c --config
|
|
set skip_next 1
|
|
case '-*'
|
|
case '*'
|
|
test "$tok" = "$target"; and return 0
|
|
return 1
|
|
end
|
|
end
|
|
return 1
|
|
end
|
|
|
|
# Global flags
|
|
complete -c ssr -s c -l config -d 'Config file path' -r -F
|
|
complete -c ssr -s h -l help -d 'Show help'
|
|
|
|
# Subcommands
|
|
complete -c ssr -n __ssr_needs_subcmd -a install -d 'First-time install'
|
|
complete -c ssr -n __ssr_needs_subcmd -a sync -d 'Run a backup → cloud'
|
|
complete -c ssr -n __ssr_needs_subcmd -a restore -d 'Restore a machine'
|
|
complete -c ssr -n __ssr_needs_subcmd -a update -d 'Pull latest ssr code'
|
|
complete -c ssr -n __ssr_needs_subcmd -a schedule -d 'Manage launchd schedule'
|
|
complete -c ssr -n __ssr_needs_subcmd -a config -d 'Show/edit config'
|
|
complete -c ssr -n __ssr_needs_subcmd -a completions -d 'Install shell completions'
|
|
complete -c ssr -n __ssr_needs_subcmd -a status -d 'Show state summary'
|
|
complete -c ssr -n __ssr_needs_subcmd -a version -d 'Print version'
|
|
complete -c ssr -n __ssr_needs_subcmd -a help -d 'Show top-level help'
|
|
|
|
# Per-subcommand args
|
|
complete -c ssr -n '__ssr_using_subcmd restore' -F
|
|
complete -c ssr -n '__ssr_using_subcmd update' -s n -l dry-run -d 'Preview without pulling'
|
|
|
|
complete -c ssr -n '__ssr_using_subcmd schedule' -a 'on off status'
|
|
complete -c ssr -n '__ssr_using_subcmd config' -a 'show edit path'
|
|
complete -c ssr -n '__ssr_using_subcmd completions' -a 'install uninstall status'
|
|
complete -c ssr -n __ssr_needs_subcmd -a mackup -d 'Manage Mackup app definitions'
|
|
complete -c ssr -n '__ssr_using_subcmd mackup' -a 'scan list clean unlink'
|