mirror of
https://github.com/AntelopeIO/CLI11.git
synced 2026-07-21 14:33:28 +00:00
Rename LeapFormatter to SpringFormatter
This commit is contained in:
+1
-1
@@ -66,6 +66,6 @@ namespace {namespace} {{
|
||||
|
||||
{formatter_hpp}
|
||||
|
||||
{leap_formatter_hpp}
|
||||
{spring_formatter_hpp}
|
||||
|
||||
}} // namespace {namespace}
|
||||
|
||||
@@ -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"; }
|
||||
};
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
Reference in New Issue
Block a user