Skip to content

Commit

Permalink
Style tweaks (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-matsui authored Feb 27, 2024
1 parent a51b76b commit 7619064
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions src/Cmd/Add.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ addDependencyToManifest(
ofs << toml::format(data);

logger::info("Added", "to the poac.toml");

return EXIT_SUCCESS;
}

Expand All @@ -159,26 +158,45 @@ addMain(const std::span<const StringRef> args) {
String rev;
String branch;

// clang-format off
HashMap<
StringRef,
Fn<Option<int>(decltype(args)::iterator&, decltype(args)::iterator)>>
handlers = {
{ "--sys",
[&](auto&, auto) {
isSystemDependency = true;
return None;
} },
{ "--version", [&](auto& itr, const auto end
) { return handleNextArg(itr, end, version); } },
{ "-v", [&](auto& itr, const auto end
) { return handleNextArg(itr, end, version); } },
{ "--tag", [&](auto& itr, const auto end
) { return handleNextArg(itr, end, tag); } },
{ "--rev", [&](auto& itr, const auto end
) { return handleNextArg(itr, end, rev); } },
{ "--branch", [&](auto& itr, const auto end
) { return handleNextArg(itr, end, branch); } },
};
StringRef,
Fn<Option<int>(decltype(args)::iterator&, decltype(args)::iterator)>
>
handlers = {
{
"--sys", [&](auto&, auto) {
isSystemDependency = true;
return None;
}
},
{
"--version", [&](auto& itr, const auto end) {
return handleNextArg(itr, end, version);
}
},
{
"-v", [&](auto& itr, const auto end) {
return handleNextArg(itr, end, version);
}
},
{
"--tag", [&](auto& itr, const auto end) {
return handleNextArg(itr, end, tag);
}
},
{
"--rev", [&](auto& itr, const auto end) {
return handleNextArg(itr, end, rev);
}
},
{
"--branch", [&](auto& itr, const auto end) {
return handleNextArg(itr, end, branch);
}
},
};
// clang-format on

for (auto itr = args.begin(); itr != args.end(); ++itr) {
if (const auto res = Cli::handleGlobalOpts(itr, args.end(), "add")) {
Expand Down

0 comments on commit 7619064

Please sign in to comment.