feat: ssr mackup scan|list|clean — on-demand cfg generation with confirmation

Instead of silently writing ~/.mackup/ssr-*.cfg on every sync, generation
is now an explicit opt-in command: ssr mackup scan

  ssr mackup scan   — dry-run: shows NEW/UPD/DEL changes, prompts before writing
  ssr mackup list   — list existing generated files
  ssr mackup clean  — remove all generated files (with confirmation)

ssr sync no longer calls generate_custom_cfg automatically.
Completions updated for zsh, bash, fish.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-12 13:39:17 +02:00
parent 3e54f0ca20
commit 36d4941c95
6 changed files with 235 additions and 9 deletions
+7
View File
@@ -15,6 +15,7 @@ _ssr() {
'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'
)
@@ -59,6 +60,12 @@ _ssr() {
'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]'
;;
esac
;;
esac
+4 -1
View File
@@ -13,7 +13,7 @@ _ssr() {
cword=$COMP_CWORD
fi
local commands="install sync restore update schedule config completions status version help"
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`).
@@ -60,6 +60,9 @@ _ssr() {
completions)
COMPREPLY=( $(compgen -W "install uninstall status" -- "$cur") )
;;
mackup)
COMPREPLY=( $(compgen -W "scan list clean" -- "$cur") )
;;
*)
COMPREPLY=()
;;
+3 -1
View File
@@ -1,7 +1,7 @@
# 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 version help
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
@@ -69,3 +69,5 @@ complete -c ssr -n '__ssr_using_subcmd update' -s n -l dry-run -d 'Preview with
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'