Skip to content

Commit a2bc0aa

Browse files
committed
removed bold/underline style and gcc specific __builtin_unreachable
1 parent 5b8bbea commit a2bc0aa

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

include/parser.hpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ struct parser {
5757
}
5858

5959
void help() const {
60-
std::cerr << "Usage: \e[1m" << m_argv[0] << "\e[0m [-h,--help]";
60+
std::cerr << "Usage: " << m_argv[0] << " [-h,--help]";
6161
auto print = [this](bool with_description) {
6262
for (size_t i = 0; i != m_names.size(); ++i) {
6363
auto const& c = m_cmds.at(m_names[i]);
6464
bool is_optional = i >= m_required;
65-
if (is_optional) std::cerr << " [\e[1m" << c.shorthand << "\e[0m";
66-
if (!c.is_boolean) std::cerr << " \e[4m" << m_names[i] << "\e[0m";
65+
if (is_optional) std::cerr << " [" << c.shorthand;
66+
if (!c.is_boolean) std::cerr << " " << m_names[i];
6767
if (is_optional) std::cerr << "]";
68-
if (with_description) std::cerr << "\n\t" << c.descr << "\n";
68+
if (with_description) std::cerr << "\n\t" << c.descr << "\n\n";
6969
}
7070
};
7171
print(false);
@@ -98,9 +98,7 @@ struct parser {
9898
template <typename T>
9999
T get(std::string const& name) const {
100100
auto it = m_cmds.find(name);
101-
if (it == m_cmds.end()) {
102-
throw std::runtime_error("error: '" + name + "' not found");
103-
}
101+
if (it == m_cmds.end()) throw std::runtime_error("error: '" + name + "' not found");
104102
auto const& value = (*it).second.value;
105103
return parse<T>(value);
106104
}
@@ -140,8 +138,8 @@ struct parser {
140138
}
141139
return ret;
142140
}
143-
assert(false);
144-
__builtin_unreachable();
141+
assert(false); // should never happen
142+
throw std::runtime_error("unsupported type");
145143
}
146144

147145
private:

0 commit comments

Comments
 (0)