summaryrefslogtreecommitdiff
path: root/src/common.cc
blob: fbd16140189e07d7705cefa2b023170570c1790e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 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 == "table")
        return formatter::Format::Table;
    else if (s == "simple-table")
        return formatter::Format::SimpleTable;
    else
        throw std::invalid_argument("invalid format");
}