diff --git a/src/lib/util/ArgumentParser.ts b/src/lib/util/ArgumentParser.ts index 6b164283..44fdbae5 100644 --- a/src/lib/util/ArgumentParser.ts +++ b/src/lib/util/ArgumentParser.ts @@ -36,10 +36,6 @@ export class ArgumentParser { for (const arg in parsedArgs) { const argumentObject = parsedArgs[arg]; - // If there isn't any more text to process and the argument is optional then return, else throw a message - if (!this.text.length && argumentObject.type === 'optional') return; - else if (!this.text.length) throw { arg, message: `${arg} is a required argument!` }; - let toParse: string | undefined; if (argumentObject.processEverything) { @@ -49,6 +45,8 @@ export class ArgumentParser { toParse = temp; } else toParse = this.text[0]; + // If there isn't anything to parse and the argument is optional then continue, else throw a message + if (!toParse.length && argumentObject.type === 'optional') continue; if (!toParse.length) throw { arg, message: `${arg} is a required argument!` }; // If there isn't an argument type specified then we check for a direct string match, and if the argument is not optional also throw a message