UNPKG

tar

Version:
50 lines • 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dealias = exports.aliases = void 0; /** * The option aliases of the commands: the short names of the tar * program, and the long names of version 7. Each alias has the name * of its option. */ exports.aliases = { C: 'cwd', f: 'file', z: 'gzip', P: 'preservePaths', U: 'unlink', 'strip-components': 'strip', stripComponents: 'strip', 'keep-newer': 'newer', keepNewer: 'newer', 'keep-newer-files': 'newer', keepNewerFiles: 'newer', k: 'keep', 'keep-existing': 'keep', keepExisting: 'keep', m: 'noMtime', 'no-mtime': 'noMtime', p: 'preserveOwner', L: 'follow', h: 'follow', onentry: 'onEntry', onReadEntry: 'onEntry', }; /** * A copy of the options, with no prototype, that has the name of the * option in place of each alias. An option that is set wins over its * aliases. */ const dealias = (options) => { const opt = Object.assign(Object.create(null), options); for (const [alias, name] of Object.entries(exports.aliases)) { if (opt[alias] !== undefined) opt[name] ??= opt[alias]; delete opt[alias]; } if (opt.noChmod === false) opt.chmod ??= true; delete opt.noChmod; return opt; }; exports.dealias = dealias; //# sourceMappingURL=dealias.js.map