Skip to content

Commit 1f9e82f

Browse files
committed
update: ewTools.js — dynamically recommend valid EntityTypes and ActionTypes
1 parent 89bcc90 commit 1f9e82f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

bin/ewTools.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ const LoggerType = Object.freeze({
1010
ERROR: "Error",
1111
EMPTY: ""
1212
})
13-
const Logger = (text, type = LoggerType.EMPTY) => {
13+
14+
const getAllActionTypes = () => Object.values(ActionTypes).map((action, index, arr) => (index === arr.length - 1 ? ` and \`${action}\`` : ` \`${action}\`,`)).join("")
15+
16+
const getAllEntityTypes = () => Object.values(EntityTypes).map((entity, index, arr) => (index === arr.length - 1 ? ` and \`${entity}\`` : ` \`${entity}\`,`)).join("")
17+
18+
function Logger(text, type = LoggerType.EMPTY) {
1419
const typeFormatted = (type === LoggerType.EMPTY) ? `${type}` : `${type}:`
1520
if (isDevelopment) console.log(`${typeFormatted}`, text)
1621
}
@@ -147,7 +152,7 @@ const handleMake = (type, title) => {
147152
generatePrototypeFile(title)
148153
break
149154
default:
150-
console.log("Invalid Type")
155+
console.log(`Invalid Type, Valid Types: ${getAllEntityTypes()}`)
151156
}
152157
}
153158

@@ -163,7 +168,7 @@ const handleDelete = (type, title) => {
163168
removeFile(title, EntityTypes.PROTOTYPE)
164169
break
165170
default:
166-
console.log("Invalid Type")
171+
console.log(`Invalid Type, Valid Types: ${getAllEntityTypes()}`)
167172
}
168173
}
169174

@@ -176,5 +181,5 @@ switch (action) {
176181
handleDelete(type, title)
177182
break
178183
default:
179-
console.log("Invalid Action")
184+
console.log(`Invalid Action. Valid Actions: ${getAllActionTypes()}`)
180185
}

0 commit comments

Comments
 (0)