This repository has been archived on 2023-01-27. You can view files and clone it, but cannot push or open issues or pull requests.
cad/commands/pack.js
2022-10-15 19:16:08 +02:00

67 lines
2.9 KiB
JavaScript

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = exports.defaultOptions = void 0;
const __1 = require("../");
const argv_1 = require("../argv");
const index_1 = require("../cad/index");
const OSR_REGEX = /^[0-9].+$/;
exports.defaultOptions = (yargs) => {
return yargs.option('src', {
default: './',
describe: 'The source directory or source file. Glob patters are supported!',
demandOption: true
}).option('dst', {
describe: 'Destination folder or file'
}).option('view', {
default: 'Isometric',
describe: 'Sets the target view'
}).option('Report', {
describe: 'Optional conversion report. Can be JSON, HTML, CSV or Markdown'
}).option('debug', {
default: false,
describe: 'Enable internal debug messages',
type: 'boolean'
}).option('skip', {
default: true,
describe: 'Skip existing files',
type: 'boolean',
}).option('dry', {
default: false,
describe: 'Run without conversion but create reports',
type: 'boolean'
}).option('alt', {
default: false,
describe: 'Alternate tokenizer'
}).option('verbose', {
default: true,
describe: 'Show internal messages',
type: 'boolean'
}).option('sw', {
describe: 'Set explicit the path to the Solidworks binaries & scripts.\
"It assumes SolidWorks.Interop.sldworks.dll and export.cmd at this location!'
}).option('script', {
describe: 'Set explicit the path to the Solidworks script'
});
};
let options = (yargs) => exports.defaultOptions(yargs);
// node ./build/main.js pack --src=../../ph3/products/products/injection/elena/cad/Global*.SLDASM --dst="../test" --verbose=true
exports.register = (cli) => {
return cli.command('pack', '', options, (argv) => __awaiter(void 0, void 0, void 0, function* () {
if (argv.help) {
return;
}
const options = argv_1.sanitizeSingle(argv);
options.verbose && __1.logger.debug("options " + argv.dst, options);
return index_1.pack(options);
}));
};
//# sourceMappingURL=pack.js.map