Skip to content

Commit

Permalink
fix usage
Browse files Browse the repository at this point in the history
  • Loading branch information
catplvsplus committed Aug 4, 2024
1 parent 151a4b3 commit d228109
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ export function createMessageCommandUsage(data: MessageCommandResolvable, option

if (options?.flags?.include !== false && command.flags) for (const flagData of command.flags) {
const flag = isJSONEncodable(flagData) ? flagData.toJSON() : flagData;
const brackets = flag.mandatory
? options?.flags?.flagBrackets?.mandatory ?? ['<', '>']
: flag.required
? options?.flags?.flagBrackets?.required ?? ['<', '>']
: options?.flags?.flagBrackets?.optional ?? ['[', ']'];
const brackets = flag.required
? options?.flags?.flagBrackets?.required ?? ['<', '>']
: options?.flags?.flagBrackets?.optional ?? ['[', ']'];
const mandatory = options?.flags?.flagBrackets?.mandatory ?? ['', '']

let value = `${options?.flags?.useShort ? '-' + flag.short : '--' + flag.name}`;

if (options?.flags?.showValueType) value += `=${brackets[0]}${flag.value_type === 'string' ? 'string' : 'boolean'}${flag.multiple ? '...' : ''}${brackets[1]}`;

usage += ` ${mandatory[0]}${value}${mandatory[1]}`;
}

Check notice on line 49 in packages/message-command-utils/src/helpers/createMessageCommandUsage.ts

View check run for this annotation

codefactor.io / CodeFactor

packages/message-command-utils/src/helpers/createMessageCommandUsage.ts#L22-L49

Complex Method
return usage;
Expand Down

0 comments on commit d228109

Please sign in to comment.