You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generally I have to using customized args parser to write tje following code. I was hope that citty could support the requirement said in the title, since it already use mir under the hood.
importprocessfrom'node:process'importparseArgsfrom'mri'import{defineCommand,runMain,showUsage}from'citty'import{ensureConfig,logger}from'./utils.js'import{bundle}from'./commands/bundle.js'import{version,description,}from'../../package.json'assert{type: 'json' }import{DEFAULT_CONFIG_FILENAME}from'./constants.js'interfaceParsedArgs{config?: string|truec?: string|true// `citty` intercept the help option, so we don't need to deal with it// help?: boolean// h?: boolean}constmain=defineCommand({meta: {name: 'rolldown',
version,
description,},args: {config: {type: 'string',alias: 'c',description:
'Use this config file (if argument is used but value is unspecified, defaults to `rolldown.config.js`)',},help: {type: 'boolean',alias: 'h',description: 'Show this help message',},},asyncrun(_ctx){// FIXME: `citty` doesn't support detecting if an argument is unspecifiedconstparsedArgs=parseArgs<ParsedArgs>(process.argv.slice(2))letargConfig=parsedArgs.c||parsedArgs.configif(argConfig){// If config is specified, we will ignore other arguments and bundle with the specified configif(argConfig==true){argConfig=DEFAULT_CONFIG_FILENAME}awaitbundle(argConfig)return}showUsage(main)},})runMain(main)
Additional information
Would you be willing to help implement this feature?
The text was updated successfully, but these errors were encountered:
Describe the feature
Generally I have to using customized args parser to write tje following code. I was hope that
citty
could support the requirement said in the title, since it already usemir
under the hood.Additional information
The text was updated successfully, but these errors were encountered: