{"size": 673, "ext": "js", "max_stars_repo_path": "ScanCard.js", "max_stars_repo_name": "stejsoftware/card-reader-kiosk", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ScanCard.js", "max_issues_repo_name": "stejsoftware/card-reader-kiosk", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ScanCard.js", "max_forks_repo_name": "stejsoftware/card-reader-kiosk", "max_forks_repo_forks_event_min_datetime": "2021-01-20T05:16:40.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-24T03:09:35.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 25.8846153846, "max_line_length": 85, "alphanum_fraction": 0.5601783061}
require("dotenv").config();

const program = require("commander")
  .version("0.1")
  .option("-c, --code <code>")
  .parse(process.argv);

const client = require("mqtt")
  .connect(process.env.borkerURL, { protocolId: "MQIsdp", protocolVersion: 3 })
  .on("error", error => console.log(error))
  .on("message", (topic, message) => console.log(`[${topic}] ${message.toString()}`))
  .on("connect", () =>
    client
      .publish(
        "reader/card",
        JSON.stringify({
          BitCount: 35,
          CardType: "Test Card",
          FacilityCode: 999,
          CardCode: program.code || 123456789
        })
      )
      .end()
  )
  .subscribe("reader/#");
