]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
Prohibited snbk restore with multiple backup configs
authorCheng-Ling Lai <jamesljlster@gmail.com>
Fri, 12 Dec 2025 13:19:01 +0000 (21:19 +0800)
committerCheng-Ling Lai <jamesljlster@gmail.com>
Fri, 12 Dec 2025 13:19:01 +0000 (21:19 +0800)
client/snbk/cmd-restore.cc
doc/snbk.xml.in

index 7f3ede453f024adbe6b5b98212eb67b05322a337..345328a71866149e088527a77db25a8a059e3bd4 100644 (file)
@@ -46,7 +46,10 @@ namespace snapper
        cout << "  " << _("Restore:") << '\n'
             << "\t" << _("snbk restore [numbers]") << '\n'
             << '\n'
-            << "\t" << _("Notice: Restart the `snapperd` service to make the restored "
+            << "\t" << _("Notice:") << '\n'
+            << "\t" << _("- A backup-config must be specified to run this command.")
+                    << '\n'
+            << "\t" << _("- Restart the `snapperd` service to make the restored "
                          "snapshots visible immediately.") << '\n'
             << '\n';
     }
@@ -72,6 +75,12 @@ namespace snapper
            nums.push_back(stoi(arg));
        }
 
+       if (backup_configs.size() != 1)
+       {
+           SN_THROW(OptionsException(_("A backup-config must be specified to run this "
+                                       "command.")));
+       }
+
        unsigned int errors = 0;
 
        for (const BackupConfig& backup_config : backup_configs)
index e11b1042e40164490fce404cab4c5d3c05c14c7e..79006c3793ea6c97e2da532abaf0292ab89bf763 100644 (file)
        <term><option>restore [<replaceable>number</replaceable>]</option></term>
        <listitem>
          <para>Restore all missing snapshots or the specified snapshot back to the
-         source. A restart of the `snapperd` service is required to make the restored
-         snapshots visible immediately.</para>
+         source. A backup config must be specified to run this command. A restart of the
+         `snapperd` service is required to make the restored snapshots visible
+         immediately.</para>
        </listitem>
       </varlistentry>