commands restructured to be const vectors

This commit is contained in:
2024-04-20 12:03:20 +02:00
parent 5a38600e2a
commit 6857de7b1f
8 changed files with 46 additions and 32 deletions

View File

@@ -75,8 +75,7 @@ int PtouchPrint::run() {
mDetectedPrinters = getCompatiblePrinters();
auto numFoundPrinters = mDetectedPrinters.size();
if (numFoundPrinters == 0) {
spdlog::error(
"No compatible printers found, please make sure that they are turned on and connected");
spdlog::error("No compatible printers found, please make sure that they are turned on and connected");
return -1;
} else if (numFoundPrinters > 1) {
spdlog::warn("Found more than one compatible printer. Currently not supported.");
@@ -85,10 +84,9 @@ int PtouchPrint::run() {
auto printer = mDetectedPrinters[0];
const auto printerUsbId = printer->getUsbId();
auto devices = mUsbDeviceFactory.findDevices(printerUsbId.first, printerUsbId.second);
auto devices = mUsbDeviceFactory.findDevices(printerUsbId.first, printerUsbId.second);
if (devices.size() != 1) {
spdlog::warn(
"Found more than one device of the same printer on bus. Currently not supported");
spdlog::warn("Found more than one device of the same printer on bus. Currently not supported");
return -1;
}
printer->attachUsbDevice(std::move(devices[0]));
@@ -115,12 +113,10 @@ int PtouchPrint::run() {
printer->setFontSize(static_cast<uint8_t>(std::atoi(cmd.second.c_str())));
break;
case CliCmdType::HAlign:;
spdlog::debug("[Not implemented] Setting text horizontal alignment to {}",
cmd.second);
spdlog::debug("[Not implemented] Setting text horizontal alignment to {}", cmd.second);
break;
case CliCmdType::VAlign:;
spdlog::debug("[Not implemented] Setting text vertical alignment to {}",
cmd.second);
spdlog::debug("[Not implemented] Setting text vertical alignment to {}", cmd.second);
break;
case CliCmdType::None:;
[[fallthrough]];
@@ -209,7 +205,6 @@ void PtouchPrint::setupCliParser() {
->each([this](std::string halign) { mCommands.emplace_back(CliCmdType::HAlign, halign); });
// Image options
mApp.add_option("-i,--image", "Image to print. Excludes all text printing ")
->group("Image printing");
mApp.add_option("-i,--image", "Image to print. Excludes all text printing ")->group("Image printing");
}
} // namespace ptprnt