-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathutils.ts
27 lines (23 loc) · 981 Bytes
/
utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import * as path from 'path';
import { CommandModule } from 'yargs';
import { Arguments, CONFIG_OPTION } from '../constants';
import { configParser } from '../lib/config-parser';
import { getPaths } from '../lib/file-finder';
import { LicenseManager, ManagementMode } from '../lib/license-manager';
export function addExports (exports, command: CommandModule) {
for (const key in command) {
/* istanbul ignore else */
if (command.hasOwnProperty(key)) {
exports[key] = command[key];
}
}
}
export function manageLicense (args: Arguments, mode: ManagementMode) {
const config = configParser(path.resolve(process.cwd(), args[CONFIG_OPTION]));
const paths = getPaths(config.ignore, config.ignoreDefaultIgnores);
const licenseManager = new LicenseManager(
paths, config.license, config.licenseFormats, config.defaultFormat,
config.trailingWhitespace, mode, config.output,
);
licenseManager.manage();
}