nativescript
Version:
Command-line interface for building NativeScript projects
77 lines • 2.62 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenerateCommand = void 0;
const yok_1 = require("../common/yok");
class GenerateCommand {
// private executionOptions: ExecutionOptions;
constructor($logger,
// private $options: IOptions,
$errors) {
this.$logger = $logger;
this.$errors = $errors;
this.allowedParameters = [];
}
async execute(_rawArgs) {
try {
this.$logger.info("If you have ideas for this command, please discuss at https://nativescript.org/discord");
// await run(this.executionOptions);
}
catch (error) {
this.$errors.fail(error.message);
}
}
async canExecute(rawArgs) {
this.setExecutionOptions(rawArgs);
this.validateExecutionOptions();
return true;
}
validateExecutionOptions() {
// if (!this.executionOptions.schematic) {
// this.$errors.failWithHelp(
// `The generate command requires a schematic name to be specified.`
// );
// }
}
setExecutionOptions(rawArgs) {
// const options = this.parseRawArgs(rawArgs);
// this.executionOptions = {
// ...options,
// logger: this.$logger,
// directory: process.cwd(),
// };
}
}
exports.GenerateCommand = GenerateCommand;
/**
* Converts an array of command line arguments to options for the executed schematic.
* @param rawArgs The command line arguments. They should be in the format 'key=value' for strings or 'key' for booleans.
*/
// function parseSchematicSettings(rawArgs: string[]) {
// const [optionStrings, args] = partition<string>(rawArgs, (item) =>
// item.includes("=")
// );
// const options = optionStrings
// .map((o) => o.split("=")) // split to key and value pairs
// .map(([key, ...value]) => [key, value.join("=")]) // concat the value arrays if there are multiple = signs
// .reduce((obj, [key, value]) => {
// return { ...obj, [key]: value };
// }, {});
// return { options, args };
// }
/**
* Splits an array into two groups based on a predicate.
* @param array The array to split.
* @param predicate The condition to be used for splitting.
*/
// function partition<T>(array: T[], predicate: (item: T) => boolean): T[][] {
// return array.reduce(
// ([pass, fail], item) => {
// return predicate(item)
// ? [[...pass, item], fail]
// : [pass, [...fail, item]];
// },
// [[], []]
// );
// }
yok_1.injector.registerCommand("generate", GenerateCommand);
//# sourceMappingURL=generate.js.map
;