Skip to content

Commit

Permalink
don't delete fsl files if user rejects confirmation prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo committed Oct 9, 2024
1 parent aa0ff8d commit 0df15de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
16 changes: 7 additions & 9 deletions src/commands/schema/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,14 @@ export default class DiffSchemaCommand extends SchemaCommand {
this.log(
`Differences from the ${bold()}remote${reset()} schema to the ${bold()}local${reset()} schema:`
);
} else if (source === "active") {
this.log(
`Differences from the ${bold()}remote, active${reset()} schema to the ${bold()}local${reset()} schema:`
);
} else {
if (source === "active") {
this.log(
`Differences from the ${bold()}remote, active${reset()} schema to the ${bold()}local${reset()} schema:`
);
} else {
this.log(
`Differences from the ${bold()}remote, staged${reset()} schema to the ${bold()}local${reset()} schema:`
);
}
this.log(
`Differences from the ${bold()}remote, staged${reset()} schema to the ${bold()}local${reset()} schema:`
);
}
this.log(json.diff ? json.diff : "No schema differences");
}
Expand Down
14 changes: 7 additions & 7 deletions src/commands/schema/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@ export default class PullSchemaCommand extends SchemaCommand {
console.log(`overwrite: ${overwrite}`);
}

if (this.flags?.delete) {
// Delete extra .fsl files.
for (const deleteme of deletes) {
fs.unlinkSync(path.join(this.dir, deleteme));
}
}

const confirmed = await confirm({
message: "Accept the changes?",
default: false,
});
if (confirmed) {
if (this.flags?.delete) {
// Delete extra .fsl files.
for (const deleteme of deletes) {
fs.unlinkSync(path.join(this.dir, deleteme));
}
}

for (const filename of filenames) {
const fileres = await fetch(
new URL(`/schema/1/files/${encodeURIComponent(filename)}`, url),
Expand Down

0 comments on commit 0df15de

Please sign in to comment.