snippeteer/lib/snippets/copyright/copyright_generator.ts

35 lines
915 B
TypeScript

import { CopyrightOptions } from './copyright_options';
export class CopyrightGenerator {
public static get_copyright_notice (
opt: CopyrightOptions
): string {
let notice = '';
const date = (new Date);
const dtf = new Intl.DateTimeFormat ('en', { month: 'long' });
const year = date.getFullYear ();
const month = dtf.format (date);
if (opt.has_license) {
notice = `${'/*'}
* Copyright (C) ${opt.company || opt.author} - All Rights Reserved
* This file is part of ${opt.software} which is released under ${
opt.license}.
* See file 'LICENSE' for full license details.
* Created by ${opt.author} <${opt.email}>, ${month} ${year}
*/
`;
}
else {
notice = `${'/*'}
* Copyright (C) ${opt.company || opt.author} - All Rights Reserved
* Created by ${opt.author} <${opt.email}>, ${month} ${year}
*/
`;
}
return notice;
}
}