diff options
Diffstat (limited to 'cli.ts')
-rw-r--r-- | cli.ts | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +import { parseArgs } from "jsr:@std/cli/parse-args"; +import UICVehicle from './lib.ts' + +const flags = parseArgs(Deno.args, { + boolean: ["validate", "json", "text"], + default: { + validate: true, + json: false, + text: false + } +}); + +const uic = new UICVehicle(flags._[0] ?? prompt('\x1b[0;1;32minput: \x1b[0mProvide a UIC wagon number:'), { + allowMissmatchedReportingMarkCountry: !flags.validate, + allowUnknownReportingMarkCountry: !flags.validate, + allowUICCountryUnknown: !flags.validate, + fetchOperatorFromReportingMark: true, + validateCheckDigit: flags.validate +}) +console.log(flags.json ? JSON.stringify(uic, null, 2) : flags.text ? uic.toString() : uic); |