blob: fb2aceabd88261946b49a7b41954bf457efea0d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// SPDX-License-Identifier: BSD-3-Clause
#include "common.h"
#include <stdexcept>
formatter::Format format_from_string(std::string& s) {
if (s == "json")
return formatter::Format::JSON;
else if (s == "simple-json")
return formatter::Format::SimpleJSON;
else if (s == "table")
return formatter::Format::Table;
else if (s == "simple-table")
return formatter::Format::SimpleTable;
else
throw std::invalid_argument("invalid format");
}
|