Files
powerpoint-toolbox/node_modules/office-addin-lint/lib/cli.js
T
2025-03-07 19:22:02 +01:00

76 lines
3.0 KiB
JavaScript
Executable File

#!/usr/bin/env node
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const office_addin_usage_data_1 = require("office-addin-usage-data");
const commands = __importStar(require("./commands"));
const defaults = __importStar(require("./defaults"));
/* global process */
const commander = new commander_1.Command();
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