Rename LeapFormatter to SpringFormatter

This commit is contained in:
Kevin Heifner
2024-10-11 10:35:06 -05:00
parent a2819c1183
commit 6555b0fcb0
5 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -66,6 +66,6 @@ namespace {namespace} {{
{formatter_hpp}
{leap_formatter_hpp}
{spring_formatter_hpp}
}} // namespace {namespace}
+2 -2
View File
@@ -8,9 +8,9 @@
#include <iostream>
#include <memory>
class MyFormatter : public CLI::LeapFormatter {
class MyFormatter : public CLI::SpringFormatter {
public:
MyFormatter() : LeapFormatter() {}
MyFormatter() : SpringFormatter() {}
std::string make_option_opts(const CLI::Option *) const override { return " OPTION"; }
};
+2 -2
View File
@@ -15,8 +15,8 @@ int main(int argc, char **argv) {
app.add_flag("--random", "Some random flag");
app.fallthrough(); // flags from app will fall through to subcommands
// use LeapFormatter
auto fmt = std::make_shared<CLI::LeapFormatter>();
// use SpringFormatter
auto fmt = std::make_shared<CLI::SpringFormatter>();
app.formatter(fmt);
CLI::App *start = app.add_subcommand("start", "A great subcommand");
+1 -1
View File
@@ -35,4 +35,4 @@
#include "Formatter.hpp"
#include "LeapFormatter.hpp"
#include "SpringFormatter.hpp"
@@ -15,22 +15,22 @@
#include "App.hpp"
namespace CLI {
// [CLI11:leap_formatter_hpp:verbatim]
// [CLI11:spring_formatter_hpp:verbatim]
class LeapFormatter : public Formatter {
class SpringFormatter : public Formatter {
// pseudographics - to draw subcommand tree
const char* tree_line = reinterpret_cast<const char *>(u8"\u2502");
const char* tree_angle = reinterpret_cast<const char *>(u8"\u2514");
const char* tree_fork = reinterpret_cast<const char *>(u8"\u251C");
public:
LeapFormatter() : Formatter() {
SpringFormatter() : Formatter() {
// this gives better, more compact display
column_width(25);
}
LeapFormatter(const LeapFormatter&) = default;
LeapFormatter(LeapFormatter&&) = default;
SpringFormatter(const SpringFormatter&) = default;
SpringFormatter(SpringFormatter&&) = default;
/// This prints out all the subcommands
virtual std::string make_subcommands(const App* app, AppFormatMode mode) const {
@@ -207,5 +207,5 @@ public:
return out.str();
}
};
// [CLI11:leap_formatter_hpp:end]
// [CLI11:spring_formatter_hpp:end]
}// namespace CLI