Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ jobs:

- uses: actions/setup-python@v2

- name: Make header
run: python ./scripts/MakeSingleHeader.py CLI11.hpp

- name: Prepare CMake config
run: cmake -S . -B build
run: cmake -S . -B build -DCLI11_SINGLE_FILE=ON

- name: Make package
run: cmake --build build --target package_source
Expand All @@ -37,10 +34,13 @@ jobs:
cp build/CLI11-*-Source.* CLI11-Source
cp build/CLI11-*-Source.* .

- name: Make header
run: cmake --build build --target CLI11-generate-single-file

- uses: actions/upload-artifact@v2
with:
name: CLI11.hpp
path: CLI11.hpp
path: build/include/CLI11.hpp

- uses: actions/upload-artifact@v2
with:
Expand Down
67 changes: 67 additions & 0 deletions CLI11.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// CLI11: Version {version}
// Originally designed by Henry Schreiner
// https://github.com/CLIUtils/CLI11
//
// This is a standalone header file generated by MakeSingleHeader.py in CLI11/scripts
// from: {git}
//
// CLI11 {version} Copyright (c) 2017-2020 University of Cincinnati, developed by Henry
// Schreiner under NSF AWARD 1414736. All rights reserved.
//
// Redistribution and use in source and binary forms of CLI11, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holder nor the names of its contributors
// may be used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Standard combined includes:
{public_includes}

{version_hpp}

{macros_hpp}

{validators_hpp_filesystem}

namespace {namespace} {{

{string_tools_hpp}

{error_hpp}

{type_tools_hpp}

{split_hpp}

{config_fwd_hpp}

{validators_hpp}

{formatter_fwd_hpp}

{option_hpp}

{app_hpp}

{config_hpp}

{formatter_hpp}

}} // namespace {namespace}
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ if(CLI11_SINGLE_FILE)
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp"
COMMAND Python::Interpreter
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/MakeSingleHeader.py"
"${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp"
${CLI11_headers}
--main "${CMAKE_CURRENT_SOURCE_DIR}/CLI11.hpp.in"
--output "${CMAKE_CURRENT_BINARY_DIR}/include/CLI11.hpp"
--version "${CLI11_VERSION}"
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/include/CLI/CLI.hpp"
${CLI11_headers})
Expand Down
4 changes: 4 additions & 0 deletions include/CLI/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#pragma once

// [CLI11:public_includes:set]
#include <algorithm>
#include <cstdint>
#include <functional>
Expand All @@ -18,6 +19,7 @@
#include <string>
#include <utility>
#include <vector>
// [CLI11:public_includes:end]

// CLI Library includes
#include "ConfigFwd.hpp"
Expand All @@ -30,6 +32,7 @@
#include "TypeTools.hpp"

namespace CLI {
// [CLI11:app_hpp:verbatim]

#ifndef CLI11_PARSE
#define CLI11_PARSE(app, argc, argv) \
Expand Down Expand Up @@ -3234,4 +3237,5 @@ struct AppFriend {
};
} // namespace detail

// [CLI11:app_hpp:end]
} // namespace CLI
5 changes: 4 additions & 1 deletion include/CLI/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@

#pragma once

// [CLI11:public_includes:set]
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
// [CLI11:public_includes:set]

#include "App.hpp"
#include "ConfigFwd.hpp"
#include "StringTools.hpp"

namespace CLI {

// [CLI11:config_hpp:verbatim]
namespace detail {

inline std::string convert_arg_for_ini(const std::string &arg) {
Expand Down Expand Up @@ -348,4 +350,5 @@ ConfigBase::to_config(const App *app, bool default_also, bool write_description,
return out.str();
}

// [CLI11:config_hpp:end]
} // namespace CLI
4 changes: 4 additions & 0 deletions include/CLI/ConfigFwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@

#pragma once

// [CLI11:public_includes:set]
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
// [CLI11:public_includes:end]

#include "Error.hpp"
#include "StringTools.hpp"

namespace CLI {
// [CLI11:config_fwd_hpp:verbatim]

class App;

Expand Down Expand Up @@ -128,4 +131,5 @@ class ConfigINI : public ConfigTOML {
valueDelimiter = '=';
}
};
// [CLI11:config_fwd_hpp:end]
} // namespace CLI
4 changes: 4 additions & 0 deletions include/CLI/Error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@

#pragma once

// [CLI11:public_includes:set]
#include <exception>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
// [CLI11:public_includes:end]

// CLI library includes
#include "StringTools.hpp"

namespace CLI {
// [CLI11:error_hpp:verbatim]

// Use one of these on all error classes.
// These are temporary and are undef'd at the end of this file.
Expand Down Expand Up @@ -344,4 +347,5 @@ class OptionNotFound : public Error {

/// @}

// [CLI11:error_hpp:end]
} // namespace CLI
4 changes: 4 additions & 0 deletions include/CLI/Formatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

#pragma once

// [CLI11:public_includes:set]
#include <algorithm>
#include <string>
#include <vector>
// [CLI11:public_includes:end]

#include "App.hpp"
#include "FormatterFwd.hpp"

namespace CLI {
// [CLI11:formatter_hpp:verbatim]

inline std::string
Formatter::make_group(std::string group, bool is_positional, std::vector<const Option *> opts) const {
Expand Down Expand Up @@ -285,4 +288,5 @@ inline std::string Formatter::make_option_usage(const Option *opt) const {
return opt->get_required() ? out.str() : "[" + out.str() + "]";
}

// [CLI11:formatter_hpp:end]
} // namespace CLI
4 changes: 4 additions & 0 deletions include/CLI/FormatterFwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

#pragma once

// [CLI11:public_includes:set]
#include <map>
#include <string>
#include <utility>
#include <vector>
// [CLI11:public_includes:end]

#include "StringTools.hpp"

namespace CLI {
// [CLI11:formatter_fwd_hpp:verbatim]

class Option;
class App;
Expand Down Expand Up @@ -177,4 +180,5 @@ class Formatter : public FormatterBase {
///@}
};

// [CLI11:formatter_fwd_hpp:end]
} // namespace CLI
4 changes: 2 additions & 2 deletions include/CLI/Macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

// [CLI11:verbatim]
// [CLI11:macros_hpp:verbatim]

// The following version macro is very similar to the one in PyBind11
#if !(defined(_MSC_VER) && __cplusplus == 199711L) && !defined(__INTEL_COMPILER)
Expand Down Expand Up @@ -41,4 +41,4 @@
#define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason)))
#endif

// [CLI11:verbatim]
// [CLI11:macros_hpp:end]
4 changes: 4 additions & 0 deletions include/CLI/Option.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#pragma once

// [CLI11:public_includes:set]
#include <algorithm>
#include <functional>
#include <memory>
Expand All @@ -14,6 +15,7 @@
#include <tuple>
#include <utility>
#include <vector>
// [CLI11:public_includes:end]

#include "Error.hpp"
#include "Macros.hpp"
Expand All @@ -22,6 +24,7 @@
#include "Validators.hpp"

namespace CLI {
// [CLI11:option_hpp:verbatim]

using results_t = std::vector<std::string>;
/// callback function definition
Expand Down Expand Up @@ -1316,4 +1319,5 @@ class Option : public OptionBase<Option> {
}
}; // namespace CLI

// [CLI11:option_hpp:end]
} // namespace CLI
5 changes: 5 additions & 0 deletions include/CLI/Split.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@

#pragma once

// [CLI11:public_includes:set]
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// [CLI11:public_includes:end]

#include "Error.hpp"
#include "StringTools.hpp"

namespace CLI {
// [CLI11:split_hpp:verbatim]

namespace detail {

// Returns false if not a short option. Otherwise, sets opt name and rest and returns true
Expand Down Expand Up @@ -135,4 +139,5 @@ get_names(const std::vector<std::string> &input) {
}

} // namespace detail
// [CLI11:split_hpp:end]
} // namespace CLI
6 changes: 6 additions & 0 deletions include/CLI/StringTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#pragma once

// [CLI11:public_includes:set]
#include <algorithm>
#include <iomanip>
#include <locale>
Expand All @@ -14,9 +15,12 @@
#include <string>
#include <type_traits>
#include <vector>
// [CLI11:public_includes:end]

namespace CLI {

// [CLI11:string_tools_hpp:verbatim]

/// Include the items in this namespace to get free conversion of enums to/from streams.
/// (This is available inside CLI as well, so CLI11 will use this without a using statement).
namespace enums {
Expand Down Expand Up @@ -409,4 +413,6 @@ inline std::string &add_quotes_if_needed(std::string &str) {

} // namespace detail

// [CLI11:string_tools_hpp:end]

} // namespace CLI
7 changes: 6 additions & 1 deletion include/CLI/TypeTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@

#pragma once

#include "StringTools.hpp"
// [CLI11:public_includes:set]
#include <cstdint>
#include <exception>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
// [CLI11:public_includes:end]

#include "StringTools.hpp"

namespace CLI {
// [CLI11:type_tools_hpp:verbatim]

// Type tools

Expand Down Expand Up @@ -1540,4 +1544,5 @@ void sum_flag_vector(const std::vector<std::string> &flags, T &output) {
#endif

} // namespace detail
// [CLI11:type_tools_hpp:end]
} // namespace CLI
Loading