mongoose-management
Version:
Mongoose schemas management tool
69 lines (68 loc) • 2.03 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chalk_1 = __importDefault(require("chalk"));
class AbstractMenu {
constructor(prompts) {
this.prompts = prompts;
}
getMenuChoiceCreate(type, action = 'create') {
return {
name: `Create new ${type}`,
value: { action },
short: chalk_1.default.red(`Command - Create ${type}`),
};
}
getMenuChoiceEdit(type, data) {
return {
name: `Edit ${type}`,
value: { action: 'edit', data },
short: chalk_1.default.red(`Command - Edit ${type}`),
};
}
getMenuChoiceRemove(type, data) {
return {
name: `Remove ${type}`,
value: { action: 'remove', data },
short: chalk_1.default.red(`Command - Remove ${type}`),
};
}
getMenuChoiceSave() {
return {
name: 'Save',
value: { action: 'save' },
short: chalk_1.default.red('Command - Save'),
};
}
getMenuChoiceWrite() {
return {
name: 'Save and Write',
value: { action: 'write' },
short: chalk_1.default.red('Command - Write'),
};
}
getMenuChoiceBack() {
return {
name: 'Back',
value: { action: 'back' },
short: chalk_1.default.red('Command - Back'),
};
}
getMenuChoiceBackToCollection() {
return {
name: 'Back to collection',
value: { action: 'backToCollection' },
short: chalk_1.default.red('Command - Back to collection'),
};
}
getMenuChoiceExit() {
return {
name: 'Exit',
value: { action: 'exit' },
short: chalk_1.default.red('Command - Exit'),
};
}
}
exports.default = AbstractMenu;