Browse Source

remove custom service menu item now displays

main
deicidus 2 years ago
parent
commit
0d101930a5
  1. 3
      README.md
  2. 14
      scripts/features/index.js

3
README.md

@ -63,8 +63,7 @@ These features are planned and many are mocked up in the menus:
## Version History
* 0.1.6 Fixed AO version number crash on startup
* 0.1.5 Added support for feature submodules and adding system services to AO's features menu
* 0.1.7 Added support for feature submodules and adding system services to AO's features menu
* 0.1.4 Added fantasy hook feature to bring the AO MUD aesthetic into the terminal
* 0.1.2 AO install wizard partway done, reorganized project repos, 'Check AO install' feature
* 0.1.0 View, create or recall, upboat and downboat priorities; partial AO install wizard

14
scripts/features/index.js

@ -93,7 +93,8 @@ export async function featuresMenu(previousMenuChoice = 0) {
const serviceName = answer.features_menu.replace(/^service_/, '')
const service = new SystemServiceManager(serviceName)
const nameWithoutDot = serviceName.split('.')[0] + ' service'
await oneFeatureMenu(nameWithoutDot, service, undefined, true)
console.log('calling service menu with true')
await oneFeatureMenu(nameWithoutDot, service, true)
return answer.features_menu
}
switch(answer.features_menu) {
@ -144,8 +145,9 @@ function oneFeatureMenuChoices(name, feature, status, isCustom = false) {
if(isCustom) {
featureChoices.push({ name: 'Remove from list', value: () => {
removeCustomService(name)
featuresChoices = null
const nameWithoutLabel = name.replace(/ service/, '')
removeCustomService(nameWithoutLabel)
featuresChoices = null
}
})
}
@ -169,7 +171,7 @@ function oneFeatureMenuChoices(name, feature, status, isCustom = false) {
// Each feature can also have subfeatures/featuare submodules. These are simply features not listed in the main AO Features list
// Instead, their (usually shorter list of) menu items are listed flattened alongside the feature's menu items (no submenus)
// This has better usability than submenus, giving users more contexual cues at the same time about where they are in the menus
export async function oneFeatureMenu(name, feature) {
export async function oneFeatureMenu(name, feature, isCustom = false) {
console.log(`\n${headerStyle(name)}`)
if(feature.description && feature.description?.length >= 1) {
console.log('\n' + feature.description + '\n')
@ -177,10 +179,10 @@ export async function oneFeatureMenu(name, feature) {
let featureChoices = []
const stopSpinner = spinner('Loading status...')
const status = feature?.status() || false
featureChoices = oneFeatureMenuChoices(name, feature, status)
featureChoices = oneFeatureMenuChoices(name, feature, status, isCustom)
if(feature.submodules && Array.isArray(feature.submodules)) {
feature.submodules.forEach(subfeature => {
const submoduleChoices = oneFeatureMenuChoices(subfeature.name, subfeature)
const submoduleChoices = oneFeatureMenuChoices(subfeature.name, subfeature, undefined, isCustom)
if(submoduleChoices && submoduleChoices.length >= 1) {
featureChoices = featureChoices.concat(submoduleChoices)
}

Loading…
Cancel
Save