Show global/local file status in CLI
This commit is contained in:
parent
eb70f5a3f4
commit
893ae49c49
|
@ -2,6 +2,7 @@
|
|||
#include "./helper.h"
|
||||
|
||||
#include "../connector/syncthingconfig.h"
|
||||
#include "../connector/utils.h"
|
||||
|
||||
#include <c++utilities/application/failure.h>
|
||||
#include <c++utilities/chrono/timespan.h>
|
||||
|
@ -149,7 +150,7 @@ int Application::exec(int argc, const char *const *argv)
|
|||
}
|
||||
}
|
||||
|
||||
// finally to request / establish connection
|
||||
// finally do the request or establish connection
|
||||
if (m_args.status.isPresent() || m_args.rescanAll.isPresent() || m_args.pauseAllDirs.isPresent() || m_args.pauseAllDevs.isPresent()
|
||||
|| m_args.resumeAllDirs.isPresent() || m_args.resumeAllDevs.isPresent() || m_args.pause.isPresent() || m_args.resume.isPresent()
|
||||
|| m_args.waitForIdle.isPresent() || m_args.pwd.isPresent()) {
|
||||
|
@ -438,6 +439,8 @@ void Application::printDir(const SyncthingDir *dir)
|
|||
printProperty("Label", dir->label);
|
||||
printProperty("Path", dir->path);
|
||||
printProperty("Status", dir->statusString());
|
||||
printProperty("Global", directoryStatusString(dir->globalFiles, dir->globalDirs, dir->globalBytes), nullptr, 6);
|
||||
printProperty("Local", directoryStatusString(dir->localFiles, dir->localDirs, dir->localBytes), nullptr, 6);
|
||||
printProperty("Last scan time", dir->lastScanTime);
|
||||
printProperty("Last file time", dir->lastFileTime);
|
||||
printProperty("Last file name", dir->lastFileName);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <c++utilities/chrono/datetime.h>
|
||||
#include <c++utilities/chrono/timespan.h>
|
||||
#include <c++utilities/conversion/stringconversion.h>
|
||||
#include <c++utilities/misc/traits.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
@ -60,14 +61,14 @@ inline void printProperty(const char *propName, bool value, const char *suffix =
|
|||
printProperty(propName, value ? "yes" : "no", suffix, indentation);
|
||||
}
|
||||
|
||||
template <typename intType>
|
||||
template <typename NumberType, Traits::EnableIf<std::is_floating_point<NumberType>, std::is_integral<NumberType>>>
|
||||
inline void printProperty(
|
||||
const char *propName, const intType value, const char *suffix = nullptr, bool force = false, ApplicationUtilities::Indentation indentation = 3)
|
||||
const char *propName, const NumberType value, const char *suffix = nullptr, bool force = false, ApplicationUtilities::Indentation indentation = 3)
|
||||
{
|
||||
if (value >= 0 || force) {
|
||||
printProperty(propName, ConversionUtilities::numberToString<intType>(value).data(), suffix, indentation);
|
||||
printProperty(propName, ConversionUtilities::numberToString<NumberType>(value).data(), suffix, indentation);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace Cli
|
||||
|
||||
#endif // SYNCTHINGCTL_HELPER
|
||||
|
|
Loading…
Reference in New Issue