43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.showMultiCompositionsPicker = exports.showSingleCompositionsPicker = void 0;
|
|
const composition_prompts_1 = require("./composition-prompts");
|
|
const chalk_1 = require("./chalk");
|
|
const showSingleCompositionsPicker = async (validCompositions, logLevel) => {
|
|
const selectedComposition = (await (0, composition_prompts_1.selectAsync)({
|
|
message: 'Select composition:',
|
|
optionsPerPage: 5,
|
|
type: 'select',
|
|
choices: validCompositions.map((comp) => {
|
|
return {
|
|
value: comp.id,
|
|
title: chalk_1.chalk.bold(comp.id),
|
|
};
|
|
}),
|
|
}, logLevel));
|
|
return { compositionId: selectedComposition, reason: 'Selected' };
|
|
};
|
|
exports.showSingleCompositionsPicker = showSingleCompositionsPicker;
|
|
const showMultiCompositionsPicker = async (validCompositions, logLevel) => {
|
|
if (validCompositions.length === 1) {
|
|
const onlyComposition = validCompositions[0];
|
|
if (onlyComposition) {
|
|
return [onlyComposition.id];
|
|
}
|
|
}
|
|
const selectedComposition = await (0, composition_prompts_1.selectAsync)({
|
|
message: 'Select compositions:',
|
|
optionsPerPage: 5,
|
|
type: 'multiselect',
|
|
min: 1,
|
|
choices: validCompositions.map((comp) => {
|
|
return {
|
|
value: comp.id,
|
|
title: chalk_1.chalk.bold(comp.id),
|
|
};
|
|
}),
|
|
}, logLevel);
|
|
return selectedComposition;
|
|
};
|
|
exports.showMultiCompositionsPicker = showMultiCompositionsPicker;
|