• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

justusjonas74 / uic-918-3 / 17239909874

26 Aug 2025 01:38PM UTC coverage: 90.653% (-8.1%) from 98.775%
17239909874

Pull #27

github

web-flow
Merge d5dfe4c6b into 5c3ad2520
Pull Request #27: Add CLI

97 of 105 branches covered (92.38%)

Branch coverage included in aggregate %.

50 of 151 new or added lines in 23 files covered. (33.11%)

5 existing lines in 1 file now uncovered.

1096 of 1211 relevant lines covered (90.5%)

17.99 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/cli.ts
1
#!/usr/bin/env node
2

NEW
3
import { Command } from 'commander';
×
NEW
4
const program = new Command();
×
5

NEW
6
import chalk from 'chalk';
×
NEW
7
import interpretBarcode from './cli-logic.js';
×
8

9
// Get the version from package.json
NEW
10
import { readFileSync } from 'fs';
×
NEW
11
import { join } from 'path';
×
NEW
12
import { fileURLToPath } from 'url';
×
NEW
13
import { dirname } from 'path';
×
14

NEW
15
const __filename = fileURLToPath(import.meta.url);
×
NEW
16
const __dirname = dirname(__filename);
×
17

NEW
18
const data = JSON.parse(readFileSync(join(__dirname, './../package.json'), 'utf8'));
×
NEW
19
const { version } = data;
×
20

NEW
21
program
×
NEW
22
  .name('uic918')
×
NEW
23
  .version(version)
×
NEW
24
  .description('CLI Parser for UIC-918.3 barcodes');
×
25

26
// program
27
// .usage('[options] <file ...>')
28
// .option('-i, --image', 'if file is an image (png,jpeg,...)')
29
// .option('-s, --signature', 'verify the barcode signature')
30
// // .parse(process.argv);
31
// .argument('<string>');
NEW
32
program.command('image')
×
NEW
33
  .description('Parse an image file (png, jpeg, ...)')
×
NEW
34
  .argument('<pathToFile>', 'path of image file(s) to parse')
×
NEW
35
  .option('-s, --verifySignature', 'verify the barcode signature')
×
NEW
36
  .action((pathToFile, options) => {
×
NEW
37
    drawIntro();
×
NEW
38
    const verifySignature = options.verifySignature
×
NEW
39
    const opts = verifySignature ? { verifySignature: true } : {}
×
NEW
40
    interpretBarcode(pathToFile, opts);
×
NEW
41
  })
×
NEW
42
function drawIntro(): void {
×
43
  //  clear();
44

NEW
45
  const ascii_art = `
×
46
██╗   ██╗██╗ ██████╗     █████╗  ██╗ █████╗     ██████╗         ██╗███████╗
47
██║   ██║██║██╔════╝    ██╔══██╗███║██╔══██╗    ╚════██╗        ██║██╔════╝
48
██║   ██║██║██║         ╚██████║╚██║╚█████╔╝     █████╔╝        ██║███████╗
49
██║   ██║██║██║          ╚═══██║ ██║██╔══██╗     ╚═══██╗   ██   ██║╚════██║
50
╚██████╔╝██║╚██████╗     █████╔╝ ██║╚█████╔╝    ██████╔╝██╗╚█████╔╝███████║
51
 ╚═════╝ ╚═╝ ╚═════╝     ╚════╝  ╚═╝ ╚════╝     ╚═════╝ ╚═╝ ╚════╝ ╚══════╝
52
                                                                           `
53

NEW
54
  console.log(
×
NEW
55
    chalk.green(
×
NEW
56
      ascii_art
×
NEW
57
    ))
×
NEW
58
}
×
59

60
// function err(string: string): void {
61
//   console.error(chalk.red(`\n  ERROR: ${string}\n`));
62
// }
NEW
63
program.parse();
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc