summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-17 20:26:26 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-05-17 20:26:26 +0200
commit1be1218612b339b1fee745d8189b78b975d8b1a9 (patch)
treecce81cebe6cfe24691c3f54b548489efe0f0f6f1
parentc81fe1578e4151e230ffa08a6c5b26b535593ee7 (diff)
downloadsink-1be1218612b339b1fee745d8189b78b975d8b1a9.tar.gz
sink-1be1218612b339b1fee745d8189b78b975d8b1a9.zip
Print the full property if we print individual properties.
-rw-r--r--sinksh/syntax_modules/sink_list.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp
index 63ce527..7caeaf7 100644
--- a/sinksh/syntax_modules/sink_list.cpp
+++ b/sinksh/syntax_modules/sink_list.cpp
@@ -63,7 +63,7 @@ QByteArray baIfAvailable(const QStringList &list)
63 return list.first().toUtf8(); 63 return list.first().toUtf8();
64} 64}
65 65
66QStringList printToList(const Sink::ApplicationDomain::ApplicationDomainType &o, bool compact, const QByteArrayList &toPrint) 66QStringList printToList(const Sink::ApplicationDomain::ApplicationDomainType &o, bool compact, const QByteArrayList &toPrint, bool limitPropertySize)
67{ 67{
68 QStringList line; 68 QStringList line;
69 line << compressId(compact, o.resourceInstanceIdentifier()); 69 line << compressId(compact, o.resourceInstanceIdentifier());
@@ -74,9 +74,17 @@ QStringList printToList(const Sink::ApplicationDomain::ApplicationDomainType &o,
74 if (value.canConvert<Sink::ApplicationDomain::Reference>()) { 74 if (value.canConvert<Sink::ApplicationDomain::Reference>()) {
75 line << compressId(compact, value.toByteArray()); 75 line << compressId(compact, value.toByteArray());
76 } else if (value.canConvert<QString>()) { 76 } else if (value.canConvert<QString>()) {
77 line << value.toString().mid(0, 75); 77 if (limitPropertySize) {
78 line << value.toString().mid(0, 75);
79 } else {
80 line << value.toString();
81 }
78 } else if (value.canConvert<QByteArray>()) { 82 } else if (value.canConvert<QByteArray>()) {
79 line << value.toByteArray().mid(0, 75); 83 if (limitPropertySize) {
84 line << value.toByteArray().mid(0, 75);
85 } else {
86 line << value.toByteArray();
87 }
80 } else if (value.canConvert<QByteArrayList>()) { 88 } else if (value.canConvert<QByteArrayList>()) {
81 line << value.value<QByteArrayList>().join(", "); 89 line << value.value<QByteArrayList>().join(", ");
82 } else { 90 } else {
@@ -120,10 +128,13 @@ bool list(const QStringList &args_, State &state)
120 } 128 }
121 129
122 auto compact = options.options.contains("compact"); 130 auto compact = options.options.contains("compact");
131 bool limitPropertySize = true;
123 if (!options.options.contains("showall")) { 132 if (!options.options.contains("showall")) {
124 if (options.options.contains("show")) { 133 if (options.options.contains("show")) {
125 auto list = options.options.value("show"); 134 auto list = options.options.value("show");
126 std::transform(list.constBegin(), list.constEnd(), std::back_inserter(query.requestedProperties), [] (const QString &s) { return s.toLatin1(); }); 135 std::transform(list.constBegin(), list.constEnd(), std::back_inserter(query.requestedProperties), [] (const QString &s) { return s.toLatin1(); });
136 //Print the full property if we explicitly list properties
137 limitPropertySize = false;
127 } else { 138 } else {
128 query.requestedProperties = SinkshUtils::requestedProperties(query.type()); 139 query.requestedProperties = SinkshUtils::requestedProperties(query.type());
129 } 140 }
@@ -151,10 +162,10 @@ bool list(const QStringList &args_, State &state)
151 } 162 }
152 } 163 }
153 if (asLine) { 164 if (asLine) {
154 state.stageTableLine(printToList(o, compact, toPrint)); 165 state.stageTableLine(printToList(o, compact, toPrint, limitPropertySize));
155 } else { 166 } else {
156 state.stageTableLine(QStringList()); 167 state.stageTableLine(QStringList());
157 auto list = printToList(o, compact, toPrint); 168 auto list = printToList(o, compact, toPrint, limitPropertySize);
158 state.stageTableLine(QStringList() << "Resource: " << list.value(0)); 169 state.stageTableLine(QStringList() << "Resource: " << list.value(0));
159 state.stageTableLine(QStringList() << "Identifier: " << list.value(1)); 170 state.stageTableLine(QStringList() << "Identifier: " << list.value(1));
160 for (int i = 0; i < (list.size() - 2); i++) { 171 for (int i = 0; i < (list.size() - 2); i++) {