UNPKG

@qigy/run

Version:

A collection of tools capable of executing complex commands through their abbreviation.

22 lines (20 loc) 759 B
const core = require('./lib/core'); const { helper } = require('./lib/utils'); module.exports = new Proxy( { ui: () => core.ui(), run: (alias, ...options) => core.run(alias, options), doc: () => core.doc(), get: (_, [keyword]) => helper(core.get(keyword), true), del: (_, aliasList = []) => helper(core.del(aliasList)), add: (_, [alias, command, remark = '']) => helper(core.add(alias, command, remark)), update: (_, [alias, command, remark = '']) => helper(core.update(alias, command, remark)) }, { get(target, key) { if (!key) return Reflect.get(target, 'doc'); if (['get', 'del', 'add', 'update', 'ui'].includes(key)) return Reflect.get(target, key); return Reflect.get(target, 'run'); } } );