diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2021-06-07 01:40:32 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2021-12-02 04:05:15 +0300 |
commit | 3aed59276c2b7275603f6da18377b77718948667 (patch) | |
tree | 86816d82ab02b6e4761175d599f5749490706792 /src/common.cc | |
parent | d86ca1e596b094cba101e0e3e6c8cdb71f8116e9 (diff) |
wipp17
Diffstat (limited to 'src/common.cc')
-rw-r--r-- | src/common.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common.cc b/src/common.cc index fb2acea..711c7e0 100644 --- a/src/common.cc +++ b/src/common.cc @@ -6,12 +6,27 @@ 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"); +} + +Protocol protocol_from_string(std::string& s) { + if (s == "17") + return Protocol::P17; + + else if (s == "18") + return Protocol::P18; + + else + throw std::invalid_argument("invalid protocol"); }
\ No newline at end of file |