mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
choice argument type
This commit is contained in:
@@ -16,22 +16,14 @@ module.exports = class CurrencyCommand extends Command {
|
||||
{
|
||||
key: 'base',
|
||||
prompt: `What currency code do you want to use as the base? Either ${list(codes, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: base => {
|
||||
if (codes.includes(base.toUpperCase())) return true;
|
||||
return `Invalid base, please enter either ${list(codes, 'or')}.`;
|
||||
},
|
||||
parse: base => base.toUpperCase()
|
||||
type: 'choice',
|
||||
choices: codes
|
||||
},
|
||||
{
|
||||
key: 'target',
|
||||
prompt: `What currency code do you want to convert to? Either ${list(codes, 'or')}.`,
|
||||
type: 'string',
|
||||
validate: target => {
|
||||
if (codes.includes(target.toUpperCase())) return true;
|
||||
return `Invalid target, please enter either ${list(codes, 'or')}.`;
|
||||
},
|
||||
parse: target => target.toUpperCase()
|
||||
type: 'choice',
|
||||
choices: codes
|
||||
},
|
||||
{
|
||||
key: 'amount',
|
||||
|
||||
Reference in New Issue
Block a user