Skip to content

Commit

Permalink
Fix init to throw error and stop if config already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaswinkler committed Oct 29, 2024
1 parent 631ac66 commit 68d4707
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/screenshot/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export function createInitConfig(baseUrl: string): string {
# The title is used to describe the screenshot run
title: "My screenshot automation"
# The baseUrl is the Cumulocity base URL and can be overwritten by the command line argument
# The baseUrl is the Cumulocity URL and can be overwritten by the command line argument
# All visit URLs are relative to this baseUrl
baseUrl: "${baseUrl}"
global:
Expand Down
4 changes: 2 additions & 2 deletions src/screenshot/startup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ const log = debug("c8y:c8yscrn:startup");
if (!fs.existsSync(yamlFile)) {
fs.writeFileSync(yamlFile, createInitConfig(baseUrl), "utf8");
log(`Config file ${yamlFile} created.`);
return;
} else {
log(`Config file ${yamlFile} already exists. Skipping init.`);
throw new Error(`Config file ${yamlFile} already exists.`);
}
return;
}

if (!fs.existsSync(yamlFile)) {
Expand Down

0 comments on commit 68d4707

Please sign in to comment.