Skip to content

Commit

Permalink
fix yaml2shell for "a single scalar only" input (#49)
Browse files Browse the repository at this point in the history
Somehow it escaped the previous commit that promised this fix... :-/
  • Loading branch information
flipflip8952 authored Nov 25, 2024
1 parent b6c00cb commit d399bb3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fpsdk_apps/yaml2shell/yaml2shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ class YamlToShell
// - "Escape" single quotes
StrReplace(val, "'", "'\"'\"'");

// A YAML only consisting of a single scalar won't have a variable name
if (var.empty()) {
var = "value"; // like yq
}

std::string str = Sprintf("%s='%s'\n", var.c_str(), val.c_str());
size_ += str.size();
num_++;
Expand Down

0 comments on commit d399bb3

Please sign in to comment.