feat: improve help text for better readability, less duplication on the conventions, better syntax information.

This commit is contained in:
2026-03-16 20:53:00 +04:00
parent 675e81e67b
commit d5b99ef407
10 changed files with 332 additions and 24 deletions

View File

@@ -1,11 +1,13 @@
#pragma once
#include <string>
#include <utility>
#include <vector>
#ifndef BASE_CONVENTION_HPP
#define BASE_CONVENTION_HPP
namespace argument_parser::conventions {
enum class convention_features { ALLOW_SHORT_TO_LONG_FALLBACK, ALLOW_LONG_TO_SHORT_FALLBACK };
enum class argument_type { SHORT, LONG, POSITIONAL, INTERCHANGABLE, ERROR };
using parsed_argument = std::pair<argument_type, std::string>;
@@ -18,6 +20,9 @@ namespace argument_parser::conventions {
virtual std::string name() const = 0;
virtual std::string short_prec() const = 0;
virtual std::string long_prec() const = 0;
virtual std::string make_help_text(std::string const &short_arg, std::string const &long_arg,
bool requires_value) const = 0;
virtual std::vector<convention_features> get_features() const = 0;
protected:
base_convention() = default;