fix: fix clap manual output error.
- fix the issue that the executable in clap manual output is full path, not the file name.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "../../patch/libcxx/enumerate.hpp"
|
#include "../../patch/libcxx/enumerate.hpp"
|
||||||
#include "../../string/op.hpp"
|
#include "../../string/op.hpp"
|
||||||
#include "../../env.hpp"
|
#include "../../env.hpp"
|
||||||
|
#include <filesystem>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#define CLAP ::yycc::carton::clap
|
#define CLAP ::yycc::carton::clap
|
||||||
@@ -112,8 +113,9 @@ namespace yycc::carton::clap::manual {
|
|||||||
// only print usage if we can fetch the name of executable
|
// only print usage if we can fetch the name of executable
|
||||||
auto executable = ENV::current_exe();
|
auto executable = ENV::current_exe();
|
||||||
if (executable.has_value()) {
|
if (executable.has_value()) {
|
||||||
|
// Get the filename part and print
|
||||||
TERMCOLOR::cprintln(trctx.usage_title, TERMCOLOR::Color::Yellow, TERMCOLOR::Color::Default, TERMCOLOR::Attribute::Default, dst);
|
TERMCOLOR::cprintln(trctx.usage_title, TERMCOLOR::Color::Yellow, TERMCOLOR::Color::Default, TERMCOLOR::Attribute::Default, dst);
|
||||||
dst << INDENT << FORMAT::format(trctx.usage_body, executable.value().u8string()) << std::endl;
|
dst << INDENT << FORMAT::format(trctx.usage_body, executable.value().filename().u8string()) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto &variables = app.get_variables();
|
const auto &variables = app.get_variables();
|
||||||
|
|||||||
Reference in New Issue
Block a user