UNPKG

node-djiparsetxt

Version:

command-line application that reads a DJI '.txt' file and outputs a json.

190 lines 6.13 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CliArguments = void 0; var minimist_1 = __importDefault(require("minimist")); var CliArguments = /** @class */ (function () { function CliArguments(args) { this._isEmpty = false; if (args.length === 0) { this._isEmpty = true; } this.argv = minimist_1.default(args); } Object.defineProperty(CliArguments.prototype, "isEmpty", { get: function () { return this.isEmpty; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "print_header", { get: function () { return this.argv.header || this.argv.h; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "print_records", { get: function () { return this.argv.records || this.argv.r; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "file_paths", { get: function () { return this.argv._; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "details", { get: function () { return this.argv.details || this.argv.d; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "output", { get: function () { if (this.argv.output) { return this.argv.output; } return this.argv.o; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "unscramble", { get: function () { return this.argv.unscramble || this.argv.u; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "show_record", { get: function () { return this.argv.show_type || this.argv.s; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "pretty_print", { get: function () { return this.argv.pretty || this.argv.p; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "distrib", { get: function () { return this.argv.distribution || this.argv.D; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "csv", { get: function () { return this.argv.csv || this.argv.c; }, enumerable: false, configurable: true }); Object.defineProperty(CliArguments.prototype, "jpeg", { get: function () { return this.argv.j || this.argv.jpeg; }, enumerable: false, configurable: true }); CliArguments.print_usage = function () { console.log("Usage: node-djiparsetext FILE [FILE...] [OPTIONS]\n"); }; CliArguments.print_help = function () { CliArguments.print_usage(); console.log("Options:"); for (var _i = 0, _a = CliArguments.optionsDescriptions; _i < _a.length; _i++) { var option = _a[_i]; if (option.param_name) { console.log(" --" + option.long_name + " " + option.param_name + "," + (" -" + option.short_name + " " + option.param_name + ": " + option.description)); continue; } console.log(" --" + option.long_name + ", -" + option.short_name + ":" + (" " + option.description)); } }; CliArguments.prototype.assert_args = function () { var argv = this.argv; if (argv.help === true || argv.h === true) { CliArguments.print_help(); return true; } // if argument list empty (no filenames given) if (argv._.length === 0) { console.log("node-djiparsetxt: No files given"); CliArguments.print_usage(); return true; } return false; }; CliArguments.optionsDescriptions = [ { short_name: "u", long_name: "unscramble", description: "Create a copy of the file with the records unscrambled.", }, { short_name: "h", long_name: "header", description: "Print header info to stdout.", }, { short_name: "r", long_name: "records", description: "Print records info to stdout.", }, { short_name: "d", long_name: "details", description: "Print the details section to stdout.", }, { short_name: "o", long_name: "output", description: "Path to use for output files.", }, { short_name: "s", long_name: "show-type", description: "Show the records of the given type.", param_name: "type", }, { short_name: "D", long_name: "distribution", description: "Print the record types as they appear in the file.", }, { short_name: "c", long_name: "csv", description: "Output the parsed file in csv form", }, { short_name: "p", long_name: "pretty", description: "Pretty print the json output.", }, { short_name: "j", long_name: "jpeg", description: "Extract the found jpeg records to the current dir", }, ]; return CliArguments; }()); exports.CliArguments = CliArguments; //# sourceMappingURL=CliArguments.js.map