diff --git a/lib/dialog.ts b/lib/dialog.ts index 956fd6f..e09f2d2 100644 --- a/lib/dialog.ts +++ b/lib/dialog.ts @@ -1,3 +1,10 @@ +/* + * Copyright (C) SapphireCode - All Rights Reserved + * This file is part of Snippeteer which is released under BSD-3-Clause. + * See file 'LICENSE' for full license details. + * Created by Timo Hocker , April 2020 + */ + export class DialogHandler { public static catch (): void { process.exit (); diff --git a/lib/snippets/copyright/index.ts b/lib/snippets/copyright/index.ts index e8a7451..e011148 100644 --- a/lib/snippets/copyright/index.ts +++ b/lib/snippets/copyright/index.ts @@ -20,6 +20,7 @@ import { CopyrightOptions } from './copyright_options'; export default class Copyright implements Snippet { private options: CopyrightOptions | null = null; private cwd: string = ''; + private loaded_from_config: boolean = false; async start (cwd: string): Promise { this.cwd = cwd; @@ -32,7 +33,7 @@ export default class Copyright implements Snippet { this.fix_file_license.bind(this) ); - if (await new Confirm({ + if (!loaded_from_config && await new Confirm({ message: 'should those settings be saved for the next run?' }).run().catch(DialogHandler.catch)) { this.save_options_file(); @@ -83,8 +84,10 @@ license: ${options.license}`); const should_load = await new Confirm({ message: 'should those options be used?' }).run().catch(DialogHandler.catch); - if (should_load) + if (should_load){ this.options = options; + this.loaded_from_config = true; + } } }