change type to allow for proper defaults

This commit is contained in:
mierenmanz 2021-04-28 16:56:30 +02:00
parent 97298f17f8
commit 9c18ec2d1f
1 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,7 @@ export interface Args {
match: CommandArgumentMatchTypes match: CommandArgumentMatchTypes
// Still needs to be implemented // Still needs to be implemented
// type?: unknown // type?: unknown
defaultValue?: string defaultValue?: unknown
flag?: string flag?: string
} }
@ -15,8 +15,10 @@ export function parseArgs(
messageArgs: string[] messageArgs: string[]
): Record<string, unknown> | null { ): Record<string, unknown> | null {
if (commandArgs === undefined) return null if (commandArgs === undefined) return null
const messageArgsNullableCopy: Array<string | null> = [...messageArgs] const messageArgsNullableCopy: Array<string | null> = [...messageArgs]
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 'flag': case 'flag':