MCPcopy Create free account
hub / github.com/Martchus/syncthingtray / printDir

Method printDir

cli/application.cpp:598–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596}
597
598void Application::printDir(const RelevantDir &relevantDir) const
599{
600 const SyncthingDir *const dir = relevantDir.dirObj;
601 cout << " - " << TextAttribute::Bold;
602 if (dir->label.isEmpty()) {
603 cout << dir->id.toLocal8Bit().data() << '\n' << TextAttribute::Reset;
604 } else {
605 cout << dir->label.toLocal8Bit().data() << '\n' << TextAttribute::Reset;
606 if (dir->id != dir->label) {
607 printProperty("ID", dir->id);
608 }
609 }
610 printProperty("Path", dir->path);
611 printProperty("Status", dir->statusString());
612 if (!dir->paused) {
613 printProperty("Global", directoryStatusString(dir->globalStats), nullptr, 6);
614 printProperty("Local", directoryStatusString(dir->localStats), nullptr, 6);
615 }
616 printProperty("Last scan time", dir->lastScanTime);
617 printProperty("Last file time", dir->lastFileTime);
618 printProperty("Last file name", dir->lastFileName);
619 printProperty("Shared with", dir->deviceNames.isEmpty() ? dir->deviceIds : dir->deviceNames);
620 printProperty("Download progress", dir->downloadLabel);
621 if (!dir->completionByDevice.empty()) {
622 printProperty("Remote progress", dir->areRemotesUpToDate() ? "all up to date" : "some need bytes");
623 for (const auto &completionForDev : dir->completionByDevice) {
624 printProperty(m_connection.deviceNameOrId(completionForDev.first).toLocal8Bit().data(),
625 argsToString(dataSizeToString(completionForDev.second.globalBytes - completionForDev.second.needed.bytes), ' ', '/', ' ',
626 dataSizeToString(completionForDev.second.globalBytes), ' ', '(', static_cast<int>(completionForDev.second.percentage), " %)")
627 .data(),
628 nullptr, 6);
629 }
630 }
631 printProperty("Type", dir->dirTypeString());
632 printProperty("Ignore permissions", dir->ignorePermissions);
633 printProperty("Auto-normalize", dir->autoNormalize);
634 printProperty("Rescan interval", rescanIntervalString(dir->rescanInterval, dir->fileSystemWatcherEnabled));
635 if (dir->fileSystemWatcherEnabled) {
636 printProperty("File watcher delay", dir->fileSystemWatcherDelay, " seconds");
637 }
638 printProperty("Min. free disk percentage", dir->minDiskFreePercentage);
639 printProperty("Error", dir->globalError);
640 if (!dir->itemErrors.empty()) {
641 cout << " Failed items\n";
642 for (const SyncthingItemError &error : dir->itemErrors) {
643 printProperty(" - Message", error.message);
644 printProperty(" File", error.path);
645 }
646 }
647 cout << '\n';
648}
649
650void Application::printDev(const SyncthingDev *dev) const
651{

Callers

nothing calls this directly

Calls 8

printPropertyFunction · 0.85
directoryStatusStringFunction · 0.85
rescanIntervalStringFunction · 0.85
areRemotesUpToDateMethod · 0.80
deviceNameOrIdMethod · 0.80
dirTypeStringMethod · 0.80
dataMethod · 0.45
statusStringMethod · 0.45

Tested by

no test coverage detected