42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
|
#!/usr/bin/env node
|
||
|
"use strict";
|
||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
// Licensed under the MIT license.
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const commander = require("commander");
|
||
|
const office_addin_usage_data_1 = require("office-addin-usage-data");
|
||
|
const commands = require("./commands");
|
||
|
const defaults = require("./defaults");
|
||
|
/* global process */
|
||
|
commander.name("office-addin-lint");
|
||
|
commander.version(process.env.npm_package_version || "(version not available)");
|
||
|
commander
|
||
|
.command("check")
|
||
|
.option("--files <files>", `Specifies the source files to check. Default: ${defaults.lintFiles}`)
|
||
|
.option("--test", "Use the test lint configuration")
|
||
|
.description(`Check source files against lint rules.`)
|
||
|
.action(commands.lint);
|
||
|
commander
|
||
|
.command("fix")
|
||
|
.option("--files <files>", `Specifies the source files to fix. Default: ${defaults.lintFiles}`)
|
||
|
.option("--test", "Use the test lint configuration")
|
||
|
.description(`Apply fixes to source based on lint rules.`)
|
||
|
.action(commands.lintFix);
|
||
|
commander
|
||
|
.command("prettier")
|
||
|
.option("--files <files>", `Specifies which files to use. Default: ${defaults.lintFiles}`)
|
||
|
.description(`Make the source prettier.`)
|
||
|
.action(commands.prettier);
|
||
|
// if the command is not known, display an error
|
||
|
commander.on("command:*", function () {
|
||
|
(0, office_addin_usage_data_1.logErrorMessage)(`The command syntax is not valid.\n`);
|
||
|
process.exitCode = 1;
|
||
|
commander.help();
|
||
|
});
|
||
|
if (process.argv.length > 2) {
|
||
|
commander.parse(process.argv);
|
||
|
}
|
||
|
else {
|
||
|
commander.help();
|
||
|
}
|
||
|
//# sourceMappingURL=cli.js.map
|