Skip to content

Commit 7c1425c

Browse files
committed
refactor: update backup restore options for resource selection
Replaced the --granular option with --resources and --items for more explicit resource and item selection during backup restoration. Updated related documentation and examples to reflect these changes.
1 parent 984e6d2 commit 7c1425c

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/commands/profile/backup/restore.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ import { restoreSecrets } from "./resources/secrets";
3939
import { RestoreResult } from "./types";
4040

4141
interface RestoreOptions {
42-
granular?: boolean | string;
42+
resources?: boolean;
43+
items?: boolean;
4344
}
4445

4546
interface BackupSummary {
@@ -263,9 +264,9 @@ async function restoreBackup(options: RestoreOptions = {}) {
263264
}
264265

265266
let restoreSequence = RESTORE_SEQUENCE;
266-
const isGranularItem = options.granular === "item";
267+
const isGranularItem = !!options.items;
267268

268-
if (options.granular) {
269+
if (options.resources || options.items) {
269270
console.info("");
270271
const selectedResources = await selectResourcesToRestore();
271272
if (!selectedResources || selectedResources.length === 0) {

src/commands/profile/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ Example:
116116
backupCommand
117117
.command("restore")
118118
.description("restore profile from a backup")
119-
.option("--granular [mode]", "select specific resources to restore (use 'item' for item-level selection)")
119+
.option("-r, --resources", "select specific resources types to restore")
120+
.option("-i, --items", "select specific items within resources to restore")
120121
.action(restoreBackup)
121122
.addHelpText(
122123
"after",
@@ -127,12 +128,12 @@ Example:
127128
1. Select a backup from the list of completed backups
128129
2. Enter your account password (and OTP if 2FA is enabled)
129130
3. Review the backup contents summary
130-
4. ${highlightMSG("(Optional)")} Select specific resources to restore with --granular
131+
4. ${highlightMSG("(Optional)")} Select specific resources to restore with --resources
131132
5. Confirm and execute the restoration
132133
133134
${kleur.bold("Options")}:
134-
- ${highlightMSG("--granular")}: Select which resource types to restore.
135-
- ${highlightMSG("--granular item")}: Select resource types AND specific items within each (searchable).
135+
- ${highlightMSG("--resources")}: Select which resource types to restore.
136+
- ${highlightMSG("--items")}: Select resource types AND specific items within each (searchable).
136137
137138
${kleur.bold("Important Notes")}:
138139
- Only backups with status ${highlightMSG("completed")} can be restored.
@@ -141,8 +142,8 @@ Example:
141142
142143
Example:
143144
$ tagoio backup restore
144-
$ tagoio backup restore --granular
145-
$ tagoio backup restore --granular item
145+
$ tagoio backup restore --resources
146+
$ tagoio backup restore --items
146147
`,
147148
);
148149

0 commit comments

Comments
 (0)