Skip to content

Commit

Permalink
don't delete fsl files if user rejects confirmation prompt (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo authored Oct 9, 2024
1 parent f760ba3 commit 2decee3
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 @@ -99,16 +99,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 2decee3

Please sign in to comment.