Files
SnowLuma/.pnpm-store/v11/files/d4/9b04effde3b3bd0a3577dc33731db96ca84290c800a70995494dc94bcae09dfbdfba8d2b3a3855a4cdda985f1c6378ff6c0631fc9c815ddcb0dc80a08a8a01
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

33 lines
1.1 KiB
Plaintext

const lib = require('./nopt-lib')
const defaultTypeDefs = require('./type-defs')
// This is the version of nopt's API that requires setting typeDefs and invalidHandler on the required `nopt` object since it is a singleton.
// To not do a breaking change an API that requires all options be passed in is located in `nopt-lib.js` and exported here as lib.
// TODO(breaking): make API only work in non-singleton mode
module.exports = exports = nopt
exports.clean = clean
exports.typeDefs = defaultTypeDefs
exports.lib = lib
function nopt (types, shorthands, args = process.argv, slice = 2) {
return lib.nopt(args.slice(slice), {
types: types || {},
shorthands: shorthands || {},
typeDefs: exports.typeDefs,
invalidHandler: exports.invalidHandler,
unknownHandler: exports.unknownHandler,
abbrevHandler: exports.abbrevHandler,
})
}
function clean (data, types, typeDefs = exports.typeDefs) {
return lib.clean(data, {
types: types || {},
typeDefs,
invalidHandler: exports.invalidHandler,
unknownHandler: exports.unknownHandler,
abbrevHandler: exports.abbrevHandler,
})
}