change enum to type

This commit is contained in:
mierenmanz 2021-04-28 12:43:16 +02:00
parent ff655e0b7d
commit 8ac716d6a9

View file

@ -1,13 +1,8 @@
export enum MatchTypes { export type CommandArgumentMatchTypes = 'flag' | 'mention' | 'content' | 'rest'
'flag',
'mention',
'content',
'rest'
}
export interface Args { export interface Args {
name: string name: string
match: MatchTypes match: CommandArgumentMatchTypes
type?: unknown // Still needs to be implemented type?: unknown // Still needs to be implemented
defaultValue?: unknown // Still needs to be implemented defaultValue?: unknown // Still needs to be implemented
flag?: string flag?: string
@ -24,16 +19,16 @@ export function parseArgs(
const args: Record<string, unknown> = {} const args: Record<string, unknown> = {}
for (const entry of commandArgs) { for (const entry of commandArgs) {
switch (entry.match) { switch (entry.match) {
case MatchTypes.flag: case "flag":
parseFlags(args, entry, messageArgsNullableCopy) parseFlags(args, entry, messageArgsNullableCopy)
break break
case MatchTypes.mention: case 'mention':
parseMention(args, entry, messageArgsNullableCopy) parseMention(args, entry, messageArgsNullableCopy)
break break
case MatchTypes.content: case 'content':
parseContent(args, entry, messageArgs) parseContent(args, entry, messageArgs)
break break
case MatchTypes.rest: case 'rest':
parseRest(args, entry, messageArgsNullableCopy) parseRest(args, entry, messageArgsNullableCopy)
break break
} }