#!/bin/bash # CLI handler for `libreportal app restore ...`. # # Shapes: # libreportal app restore [snapshot|latest] [repo] # Restore from a snapshot id (or 'latest', the default). # Optional repo name: local | remote_1 | remote_2. cliAppRestore() { local app_name="$1" local snapshot="$2" local repo="$3" if [[ -z "$app_name" ]]; then isError "App name required for restore." cliShowAppHelp return 1 fi # Normalise the snapshot selector: unset args arrive as the literal # "empty" from the CLI wrapper, and the help advertises --latest, but # restorePickSnapshot expects the bare token "latest". [[ -z "$snapshot" || "$snapshot" == "empty" || "$snapshot" == "--latest" ]] && snapshot="latest" [[ -z "$repo" || "$repo" == "empty" ]] && repo="" restoreAppStart "$app_name" "$snapshot" "$repo" }