Skip to content

Commit ff12ed0

Browse files
committed
fix(cli): restore join_for_log in UnpublishCommand
2 parents 9525c63 + 57d851e commit ff12ed0

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/commands/UnpublishCommand.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,42 @@ namespace vix::commands
123123
return fs::exists(dir / ".git", ec);
124124
}
125125

126+
std::string join_for_log(const std::vector<std::string> &args)
127+
{
128+
std::ostringstream out;
129+
130+
for (std::size_t i = 0; i < args.size(); ++i)
131+
{
132+
if (i > 0)
133+
out << ' ';
134+
135+
const std::string &arg = args[i];
136+
137+
const bool needsQuotes =
138+
arg.find(' ') != std::string::npos ||
139+
arg.find('\t') != std::string::npos ||
140+
arg.find('"') != std::string::npos;
141+
142+
if (!needsQuotes)
143+
{
144+
out << arg;
145+
continue;
146+
}
147+
148+
out << '"';
149+
for (char c : arg)
150+
{
151+
if (c == '"')
152+
out << "\\\"";
153+
else
154+
out << c;
155+
}
156+
out << '"';
157+
}
158+
159+
return out.str();
160+
}
161+
126162
/* =========================
127163
Process runner (no system)
128164
========================= */

0 commit comments

Comments
 (0)