don't ask for save if loaded from config

This commit is contained in:
Timo Hocker 2020-04-16 08:04:58 +02:00
parent 1feda9d44f
commit fa5c631d23
2 changed files with 12 additions and 2 deletions

View File

@ -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 <timo@scode.ovh>, April 2020
*/
export class DialogHandler {
public static catch (): void {
process.exit ();

View File

@ -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<void> {
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;
}
}
}